126
MC96F8204
ABOV Semiconductor Co., Ltd.
11.8.7 UART Parity bit
The parity bit is calculated by doing an exclusive-OR of all the data bits. If odd parity is used, the result of the
exclusive-OR is inverted. The parity bit is located between the MSB and first stop bit of a serial frame.
P
even
= D
n-1
^ … ^ D
3
^ D
2
^ D
1
^ D
0
^ 0
P
odd
= D
n-1
^ … ^ D
3
^ D
2
^ D
1
^ D
0
^ 1
P
even
: Parity bit using even parity
P
odd
: Parity bit using odd parity
D
n
: Data bit n of the character
11.8.8 UART Transmitter
The UART transmitter is enabled by setting the TXE bit in USTCR2 register. When the Transmitter is enabled, the TXD
pin should be set to TXD function for the serial output pin of UART by the P0FSRL. The baud-rate, operation mode
and frame format must be set up once before doing any transmission. In synchronous operation mode, the SCK pin is
used as transmission clock, so it should be selected to do SCK function by P0FSRH.
11.8.8.1
UART Sending TX data
A data transmission is initiated by loading the transmit buffer (USTDR register I/O location) with the data to be
transmitted. The data be written in transmit buffer is moved to the shift register when the shift register is ready to send
a new frame. The shift register is loaded with the new data if it is in idle state or immediately after the last stop bit of the
previous frame is transmitted. When the shift register is loaded with new data, it will transfer one complete frame
according to the settings of control registers. If the 9-bit characters are used in asynchronous or synchronous
operation mode, the ninth bit must be written to the USTTX8 bit in USTCR3 register before it is loaded to the transmit
buffer (USTDR register).
11.8.8.2
UART Transmitter flag and interrupt
The USART transmitter has two flags which indicate its state. One is USART data register empty flag (DRE) and the
other is transmit completion flag (TXC). Both flags can be interrupt sources.
DRE flag indicates whether the transmit buffer is ready to receive new data. This bit is set when the transmit buffer is
empty and cleared when the transmit buffer contains data to be transmitted but has not yet been moved into the shift
register. And also this flag can be cleared by writing
‘0’ to this bit position. Writing ‘1’ to this bit position is prevented.
When the data register empty interrupt enable (DRIE) bit in USTCR2 register is set and the global interrupt is enabled,
USTST status register empty interrupt is generated while DRE flag is set.
The transmit complete (TXC) flag bit is set when the entire frame in the transmit shift register has been shifted out and
there is no more data in the transmit buffer. The TXC flag is automatically cleared when the transmit complete interrupt
serve routine is executed, or it can be cleared by writing
‘0’ to TXC bit in USTST register.
When the transmit complete interrupt enable (TXCIE) bit in USTCR2 register is setand the global interrupt is enabled,
UART transmit complete interrupt is generated while TXC flag is set.
Содержание MC96F8104M
Страница 13: ...13 MC96F8204 ABOV Semiconductor Co Ltd 4 Package Diagram Figure 4 1 20 Pin SOP Package...
Страница 14: ...14 MC96F8204 ABOV Semiconductor Co Ltd Figure 4 2 20 Pin TSSOP Package...
Страница 15: ...15 MC96F8204 ABOV Semiconductor Co Ltd Figure 4 3 16 Pin SOPN Package...
Страница 16: ...16 MC96F8204 ABOV Semiconductor Co Ltd Figure 4 4 10 Pin SSOP Package...
Страница 17: ...17 MC96F8204 ABOV Semiconductor Co Ltd Figure 4 5 8 Pin SOP Package...