HT46RU66/HT46CU66
·
USR register
RXIF flag is cleared when the USR register is read
with RXIF set, followed by a read from the RXR reg-
ister, and if the RXR register has no data available.
The USR register is the status register for the UART,
which can be read by the program to determine the
present status of the UART. All flags within the USR
register are read only.
¨
RIDLE
The RIDLE flag is the receiver status flag. When this
read only flag is ²0² it indicates that the receiver is
between the initial detection of the start bit and the
completion of the stop bit. When the flag is ²1² it in-
dicates that the receiver is idle. Between the com-
pletion of the stop bit and the detection of the next
start bit, the RIDLE bit is ²1² indicating that the
UART is idle.
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 indicates 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.
¨
OERR
The OERR flag is the overrun error flag, which indi-
cates when the receiver buffer has overflowed.
When this read only flag is ²0² there is no overrun er-
ror. When the flag is ²1² an overrun error occurs
which will inhibit further transfers to the RXR receive
data register. The flag is cleared by a software se-
quence, which is a read to the status register USR
followed by an access to the RXR data register.
¨
TIDLE
The TIDLE flag is known as the transmission com-
plete flag. When this read only flag is ²0² it indicates
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 trans-
mitted. When TIDLE is ²1² the TX pin becomes idle.
The TIDLE flag is cleared by reading the USR regis-
ter with TIDLE set and then writing to the TXR regis-
ter. The flag is not generated when a data character,
or a break is queued and ready to be sent.
¨
FERR
The FERR flag is the framing error flag. When this
read only flag is ²0² it indicates no framing error.
When the flag is ²1² it indicates that a framing error
has been detected for the current character. The
flag can also be cleared by a software sequence
which will involve a read to the USR status register
followed by an access to the RXR data register.
¨
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 con-
tains new data. When the contents of the shift regis-
ter 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 received word, the
appropriate receive-related flags NF, FERR, and/or
PERR are set within the same clock cycle. The
¨
NF
The NF flag is the noise flag. When this read only
flag is ²0² it indicates a no noise condition. When
the flag is ²1² it indicates that the UART has de-
tected noise on the receiver input. The NF flag is set
during the same cycle as the RXIF flag but will not
be set in the case of an overrun. The NF flag can be
cleared by a software sequence which will involve a
read to the USR status register, followed by an ac-
cess to the RXR data register.
b
7
b
0
P
E
R
R
N
F
F
E
R
R
O
E
R
R
R
I
D
L
E
R
X
I
F
T
I
D
L
E
T
X
I
F
U
S
R
R
e
g
i
s
t
e
r
T
1
0
r
a
n
s
m
i
t
c
c
d
a
t
a
t
n
r
e
n
g
i
s
e
t
e
r
e
m
p
t
y
:
:
c
c
h
a
a
r
r
a
a
t
t
e
e
r
r
a
s
f
r
r
s
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
h
r
o
t
t
r
a
n
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
1
r
a
n
s
m
i
s
s
i
o
n
i
d
l
e
:
:
n
t
o
t
r
a
n
s
m
i
s
s
i
o
i
n
i
n
r
p
r
o
g
r
e
s
s
0
r
a
n
s
m
i
s
s
i
o
n
n
p
o
g
r
e
s
s
R
1
e
c
c
e
e
i
v
e
R
X
R
r
e
g
i
s
t
e
r
s
t
a
t
u
s
:
:
R
R
X
R
R
r
e
e
g
g
i
i
s
s
t
t
e
r
r
h
i
a
s
a
v
a
t
i
l
a
b
l
e
d
a
t
a
0
X
r
e
s
e
m
p
y
R
e
e
i
v
e
r
s
t
a
t
u
s
1
0
:
:
r
d
e
c
e
a
i
v
e
r
i
s
i
d
l
e
a
t
b
e
e
i
r
n
g
r
e
c
e
i
v
e
d
O
1
0
v
r
r
e
u
n
r
r
e
o
r
:
:
o
n
v
o
r
u
n
r
r
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