#ifndef F_CPU
#define F_CPU 16000000UL //16MHz
#endif
#define UART_BAUDRATE 9600
#define MYUBRR (((F_CPU/16)/UART_BAUDRATE)-1)
void serial_init( void )
{
UBRR0H = (uint8_t) (MYUBRR>>8);
UBRR0L = (uint8_t)(MYUBRR);
UCSR0B = (1<<RXEN0)|(1<<TXEN0);
UCSR0C = (3<<UCSZ00);
}
void serial_chr( unsigned char data )
{
while(!(UCSR0A & (1<<UDRE0)));
UDR0 = data;
}
unsigned char serial_read( void )
{
while(!(UCSR0A & (1<<RXC0)));
return UDR0;
}
void setup(){
serial_init();
serial_chr('A');
}
void loop(){
}