0

But it is giving error like avr/io.h No such file or Directo

while (1) 
{
     //INIT USART
     UCSRB = 0x18;      //reciever enable , transmitter enable
     UCSRC = 0x86;      //8 bit , 1 stop bit ,
     UBRRH = 0;
     UBRRL = xtal/16/baud-1;
     while(1)
     {
         printf("Hello World");
     }
}

}

vijay patil
  • 51
  • 2
  • 8
  • 1
    The code you're showing doesn't even do `#include `, you realize that's quite confusing, right? – unwind Nov 01 '13 at 12:09

2 Answers2

0

If you create a new project in AS6, it already implements a template code which compiles without any errors.

Either you deleted this code and entered a wrong code, where <avr/io.h is missing or your installation is corrupted.

mfg

Progga
  • 343
  • 1
  • 3
  • 11
0

You need to include the header file with your code. So add:

#include <avr/io.h>

At the top of your source. You'll see when you inspect that header you will see that it conditionally includes the specific header for your chipset you are using. Assuming you are using the AVR-GCC you will want to add a a flag like -mmcu=atmega328p when compiling to tell it which chip you are targeting.

shuttle87
  • 15,466
  • 11
  • 77
  • 106