This article covers data transmission using 8 bit USART. The readers should have a basic understanding of serial communication and how to receive the serial data output. More details on these topics are available on Serial communication using AVR Microcontroller USART.
The registers of USART system are already explained in previous article. Before transmitting the data, it must be stored in UDR register. The HyperTerminal software is used to show received data. The following steps can be followed to transmit the data to COM port of computer.
i. Monitor the status of UDRE (USART Data register Empty) flag.
ii. A high on the UDRE indicates that the UDR register is empty and ready to accept new data to be sent.
void usart_putch(unsigned char send)
while ((UCSRA & (1 << UDRE)) == 0); // Do nothing until UDR is ready..
// for more data to be written to it
UDR = send; // Send the byte