EasyManua.ls Logo

STC micro STC8A8K64D4 Series - UART1 Mode 2

Default Icon
901 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
STC8A8K64D4 Series Manual
- 377 -
57600
FFD0H
FFFCH
FFD0H
FFFCH
F4H
FFH
FAH
-
38400
FFB8H
FFFAH
FFB8H
FFFAH
EEH
-
F7H
-
19200
FF70H
FFF4H
FF70H
FFF4H
DCH
FDH
EEH
-
9600
FEE0H
FFE8H
FEE0H
FFE8H
B8H
FAH
DCH
FDH
18.432
115200
FFD8H
-
FFD8H
-
F6H
-
FBH
-
57600
FFB0H
-
FFB0H
-
ECH
-
F6H
-
38400
FF88H
FFF6H
FF88H
FFF6H
E2H
-
F1H
-
19200
FF10H
FFECH
FF10H
FFECH
C4H
FBH
E2H
-
9600
FE20H
FFD8H
FE20H
FFD8H
88H
F6H
C4H
FBH
22.1184
115200
FFD0H
FFFCH
FFD0H
FFFCH
F4H
FFH
FAH
-
57600
FFA0H
FFF8H
FFA0H
FFF8H
E8H
FEH
F4H
FFH
38400
FF70H
FFF4H
FF70H
FFF4H
DCH
FDH
EEH
-
19200
FEE0H
FFE8H
FEE0H
FFE8H
B8H
FAH
DCH
FDH
9600
FDC0H
FFD0H
FDC0H
FFD0H
70H
F4H
B8H
FAH
14.3.7 UART1 Mode 2
If the two bits of SM0 and SM1 are 10, UART1 operates in mode 2. UART1 operating in mode 2 is a 9-bit data
asynchronous communication UART. One frame of data consists of 11 bits: 1 start bit, 8 data bits (LSB first), 1 programmable
bit (9
th
bit) and 1 stop bit. The transmitted programmable bit (9
th
bit) is supplied by TB8 in SCON, which can be confugred
as either 1 or 0 by software. Or, the odd/even parity bit P in the PSW can be loaded into TB8. Not only can TB8 be used as a
multi-machine communication address/data flag, but also it can be used as datum parity check bit. The 9
th
bit is received into
RB8 of SCON. TxD is the transmitting pin, and RxD is the receiving pin, the serial port is a full duplex receiver/transmitter.
The baud rate of mode 2 is fixed to the system clock divided by 64 or 32 depending on the value of SMOD in PCON.
The baud rate of UART1 mode 2 is shown in the following table, where SYSclk is the system operating frequency.
SMOD
Baud rate calculation formula
0
baudrate
SYSclk
64
1
baudrate
SYSclk
32
Except that the source of the baud rate is slightly different, and the 9
th
bit of the shift register supplied by TB8 while
being sent is different, the functional and structure of mode 2 and mode 1 are basically the same, the receiving / sending
operation and timing of mode 2 and mode 1are also basically the same.
After the receiver receives a frame of information, the following conditions must be met at the same time.
·RI=0
·SM2=0 or SM2=1 and the 9
th
bit received RB8=1.
Only when the two conditions above are met at the same time, the data received in shift register is loaded into SBUF
and RB8. The RI flag is set to 1, and the interrupt is requested to CPU. If one of the above conditions is not met, the data
received in the shift register is invalid and is discarded, and RI is not set. Regardless of the above conditions are met or not,
the receiver begins to detect the RxD pin hopping information again to receive the next frame of information. In mode 2, the
received stop bit is not related to SBUF, RB8 and RI.
It provides for the convenience of multi-machine communication by setting SM2, TB8 of SCON and communication
protocol using the software.
Write
SBUF
TxD
TI
D0 D1 D2 D3 D4 D5 D6 D7Start Stop
Transmitting data (UART1 mode 2)
TB8

Table of Contents

Related product manuals