#define F_CPU 7372800 // Clock Speed
# define USART_BAUDRATE 9600
# define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1)
void init_usart(void)
{
UCSRB |= (1 << RXEN) | (1 << TXEN); // Turn on the transmission and reception circuitry
UCSRC |= (1 << URSEL) | (1 << UCSZ0) | (1 << UCSZ1); // Use 8- bit character sizes
UBRRH = (BAUD_PRESCALE >> 8); // Load upper 8- bits of the baud rate value into the high byte of the UBRR register
UBRRL = BAUD_PRESCALE; // Load lower 8- bits of the baud rate value into the low byte of the UBRR register
}
void main()
{
init_usart();
char number[26];
while ((UCSRA & (1 << UDRE)) == 0) {}; // Do nothing until UDR is ready for more data to be written to it
UDR = number; // Echo back the received byte back to the computer
while ((UCSRA & (1 << UDRE)) == 0) {};
}