Receiving Frames with 9 Data If 9-bit characters are used (UCSZn=7) the ninth bit must be read from the RXB8n bit in
Bits
UCSRnB before reading the low bits from the UDRn. This rule applies to the FEn,
DORn and UPEn Status Flags as well. Read status from UCSRnA, then data from
UDRn. Reading the UDRn I/O location will change the state of the receive buffer FIFO
and consequently the TXB8n, FEn, DORn and UPEn bits, which all are stored in the
FIFO, will change.
The following code example shows a simple USART receive function that handles both
nine bit characters and the status bits.
172
ATmega48/88/168
2545D–AVR–07/04