STC8A8K64D4 Series Manual
Write
S2BUF
TxD2
S2TI
D0 D1 D2 D3 D4 D5 D6 D7Start Stop
Transmitting data (UART2 mode 0)
Write
S2CON
RxD2
S2RI
D0 D1 D2 D3 D4 D5 D6 D7Start Stop
S2REN=1, S2RI=0
Receiving data (UART2 mode 0)
The baud rate of UART2 is variable. It is generated by T2. If the timer is in 1T mode (12x speed), the corresponding
baud rate is increased by 12 times.
The baud rate of UART2 mode 0 is calculated as follows, where SYSclk is the system operating frequency.
Baud rate calculation formula
14.4.4 UART2 Mode 1
UART2 operating in mode 1 is a 9-bit data UART mode with variable baud rate. One frame data consists of 11
bits: 1 start bit, 8 data bits (LSB first), 1 programmable bit (9
th
bit) and 1 stop bit. The baud rate is variable, which can
be set by the software as needed. TxD2 is the data transmitting pin, and RxD2 is the data receiving pin, the serial port
is a full duplex receiver/transmitter.
Write
S2BUF
TxD2
S2TI
D0 D1 D2 D3 D4 D5 D6 D7Start Stop
Transmitting data (UART2 mode 1)
TB8
Write
S2CON
RxD2
S2RI
D0 D1 D2 D3 D4 D5 D6 D7Start Stop
Receiving data (UART2 mode 1)
RB8
S2REN=1,S2RI=0
The baud rate calculation formula of UART2 mode 1 is exactly the same as that of mode 0. Please refer to the
mode 0 baud rate calculation formula.