Sign In

Clearing The Receive Buffer

Ashwin United States

Hardware: ATmesga328 Running At 16MHz Software: Arduino IDE For Uploading My Embedded C Code

How does the receive buffer get cleared when using USART communication to just read from an entered value using the serial monitor.

char ch;
ch=UDR0; // is this line responsible for clearing the receive buffer?



R Avinash
2016-05-21 13:15:45
Yes, after the complete 8 bits of a frame is sampled in the shiftregister, they are moved to the receive buffer which is two frame FIFO. Reading the contents of UDR0 clears the buffer so that it can store next frame. If the UDR0 is not read and a new startbit is detected on serial RX line, a data overrun situation will be created.

Post a reply to Ashwin

Think you can help Ashwin ? Then post your thoughts that might help Ashwin. You will earn a lot of reputation in the technical community.

If your program is in multiple files, then ZIP the entire folder and attach below

Images and Screenshots

These helps other better understand your suggestion.