#define F_CPU 16000000UL
#define BAUD 9600
#include <avr/io.h>
#include "util/delay.h"
#include "avr/interrupt.h"
char msg;
int main(void)
{
sei();
UBRRH = 0;
UBRRL = 103;
DDRD |= 0x1;
UCSRA |= 0;
UCSRB |= (1<<TXEN)| (1<<RXEN) | (1<<RXCIE);
UCSRC |= (1<<URSEL) | (1<<UCSZ1) | (1<<UCSZ0);
/* Replace with your application code */
while (1)
{
_delay_ms(500);
while((UCSRA &(1<<UDRE)) == 0);
UDR = msg;
}
}
ISR(USART_RXC_vect){
msg = UDR;
}