USR Register
The USR register is the status register for the UART, which can be read by the program to deter
-
mine the present status of the UART. All flags within the USR register are read only.
Further explanation on each of the flags is given below:
· TXIF
The TXIF flag is the transmit data register empty flag. When this read only flag is ²0², it indicates
that the character is not transferred to the transmit shift registers. When the flag is ²1², it indi-
cates that the transmit shift register has received a character from the TXR data register. The
TXIF flag is cleared by reading the UART status register (USR) with TXIF set and then writing to
the TXR data register. Note that when the TXEN bit is set, the TXIF flag bit will also be set since
the transmit buffer is not yet full.
· TIDLE
The TIDLE flag is known as the transmission complete flag. When this read only flag is ²0²,itin
-
dicates that a transmission is in progress. This flag will be set to ²1² when the TXIF flag is ²1²
and when there is no transmit data, or break character being transmitted. When TIDLE is ²1²,
the TX pin becomes idle. The TIDLE flag is cleared by reading the USR register with TIDLE set
and then writing to the TXR register. The flag is not generated when a data character, or a break
is queued and ready to be sent.
·
RXIF
The RXIF flag is the receive register status flag. When this read only flag is ²0², it indicates that the
RXR read data register is empty. When the flag is ²1², it indicates that the RXR read data register
contains new data. When the contents of the shift register are transferred to the RXR register, an
interrupt is generated if RIE=1 in the UCR2 register. If one or more errors are detected in the re
-
ceived word, the appropriate receive-related flag(s) NF, FERR, and/or PERR are set within the
68
I/O Type MCU
U S R R e g i s t e r
b 7
R I D L EO E R RN FP E R R
b 0
R X I F T I D L E T X I F
T r a n s m i t d a t a r e g i s t e r e m p t y
1 : c h a r a c t e r t r a n s f e r r e d t o t r a n s m i t s h i f t r e g i s t e r
0 : c h a r a c t e r n o t t r a n s f e r r e d t o t r a n s m i t s h i f t r e g i s t e r
T r a n s m i s s i o n i d l e
1 : n o t r a n s m i s s i o n i n p r o g r e s s
0 : t r a n s m i s s i o n i n p r o g r e s s
R e c e i v e R X R r e g i s t e r s t a t u s
1 : R X R r e g i s t e r h a s a v a i l a b l e d a t a
0 : R X R r e g i s t e r i s e m p t y
R e c e i v e r s t a t u s
1 : r e c e i v e r i s i d l e
0 : d a t a b e i n g r e c e i v e d
O v e r r u n e r r o r
1 : o v e r r u n e r r o r d e t e c t e d
0 : n o o v e r r u n e r r o r d e t e c t e d
F r a m i n g e r r o r f l a g
1 : f r a m i n g e r r o r d e t e c t e d
0 : n o f r a m i n g e r r o r
N o i s e f l a g
1 : n o i s e d e t e c t e d
0 : n o n o i s e d e t e c t e d
P a r i t y e r r o r f l a g
1 : p a r i t y e r r o r d e t e c t e d
0 : n o p a r i t y e r r o r d e t e c t e d
F E R R