
#include <io.h>
#include <iom16.h>

void USART_Init(unsigned int baud)
{
UBRRH = (unsigned char) (baud >> 8);
UBRRL = (unsigned char) baud;
UCSRB = 0x1C;
UCSRC = 0x46;
}

unsigned char USART_receive (void)
{
while ( ! (UCSRA & 0x80));
return UDR;
}

void USART_transmit ( unsigned char data)
{
while ( ! ( UCSRA & 0x40));
UDR = data;
}

void init_device(void)
{
DDRA = 0x3F;
PORTA = 0x00;

}
void wait(unsigned long time)
{
for(unsigned long i=0; i<time;i++);

}


int main(void)
{
//char transmit = 0x31;
char receive = 0;
init_device();
USART_Init(207);

while(1)
{
 
  receive = USART_receive();
  PORTA = receive;
  USART_transmit(0x31);

}

}