8 ucsr1a - usart1 control and status register a, Atmega128rfa1 – Rainbow Electronics ATmega128RFA1 User Manual
Page 361

361
8266A-MCU Wireless-12/09
ATmega128RFA1
Receive Data Buffer Register (RXB). For 5-, 6-, or 7-bit characters the upper unused
bits will be ignored by the Transmitter and set to zero by the Receiver. The transmit
buffer can only be written when the UDRE1 Flag in the UCSR1A Register is set. Data
written to UDR1 when the UDRE1 Flag is not set, will be ignored by the USART
Transmitter. When data is written to the transmit buffer and the Transmitter is enabled,
the Transmitter will load the data into the Transmit Shift Register when the Shift
Register is empty. Then the data will be serially transmitted on the TxD1 pin. The
receive buffer consists of a two level FIFO. The FIFO will change its state whenever the
receive buffer is accessed. Due to this behavior of the receive buffer, do not use Read-
Modify-Write instructions (SBI and CBI) on this location. Be careful when using bit test
instructions (SBIC and SBIS), since these also will change the state of the FIFO.
•
Bit 7:0 – UDR17:10 - USART I/O Data Register
23.10.8 UCSR1A – USART1 Control and Status Register A
Bit
7
6
5
4
3
2
1
0
NA ($C8)
RXC1
TXC1
UDRE1
FE1
DOR1
UPE1
U2X1
MPCM1
UCSR1A
Read/Write
R
RW
R
R
R
R
RW
RW
Initial Value
0
0
1
0
0
0
0
0
•
Bit 7 – RXC1 - USART Receive Complete
This flag bit is set when there are unread data in the receive buffer and cleared when
the receive buffer is empty (i.e., does not contain any unread data). If the Receiver is
disabled, the receive buffer will be flushed and consequently the RXC1 bit will become
zero. The RXC1 Flag can be used to generate a Receive Complete interrupt (see
description of the RXCIE1 bit).
•
Bit 6 – TXC1 - USART Transmit Complete
This flag bit is set when the entire frame in the Transmit Shift Register has been shifted
out and there are no new data currently present in the transmit buffer (UDR1). The
TXC1 Flag bit is automatically cleared when a transmit complete interrupt is executed,
or it can be cleared by writing a one to its bit location. The TXC1 Flag can generate a
Transmit Complete interrupt (see description of the TXCIE1 bit).
•
Bit 5 – UDRE1 - USART Data Register Empty
The UDRE1 Flag indicates if the transmit buffer (UDR1) is ready to receive new data. If
UDRE1 is one, the buffer is empty, and therefore ready to be written. The UDRE1 Flag
can generate a Data Register Empty interrupt (see description of the UDRIE1 bit).
UDRE1 is set after a reset to indicate that the Transmitter is ready.
•
Bit 4 – FE1 - Frame Error
This bit is set if the next character in the receive buffer had a Frame Error when
received. I.e., when the first stop bit of the next character in the receive buffer is zero.
This bit is valid until the receive buffer (UDR1) is read. The FE1 bit is zero when the
stop bit of received data is one. Always set this bit to zero when writing to UCSR1A.
•
Bit 3 – DOR1 - Data OverRun
This bit is set if a Data OverRun condition is detected. A Data OverRun occurs when
the receive buffer is full (two characters), it is a new character waiting in the Receive
Shift Register and a new start bit is detected. This bit is valid until the receive buffer
(UDR1) is read. Always set this bit to zero when writing to UCSR1A.
•
Bit 2 – UPE1 - USART Parity Error