Hardware manual

Common Features Description
Atmel 8051 Microcontrollers Hardware Manual 2-45
4316A–8051–01/04
The serial port can operate in 4 modes:
Mode 0: Serial data enters and exits through RXD. TXD outputs the shift clock. 8 bits
are transmitted/received: 8 data bits (LSB first). The baud rate is fixed at 1/12 the oscil-
lator frequency.
Mode 1: 10 bits are transmitted (through TXD) or received (through RXD): a start bit (0),
8 data bits (LSB first), and a stop bit (1). On receive, the stop bit goes into RB8 in Spe-
cial Function Register SCON. The baud rate is variable.
Mode 2: 11 bits are transmitted (through TXD) or received (through RXD): a start bit (0),
8 data bits (LSB first), a programmable 9th data bit, and a stop bit (1). On transmit, the
9th data bit (TB8 in SCON) can be assigned the value of 0 or 1. Or, for example, the par-
ity bit (P, in the PSW) could be moved into TB8. On receive, the 9th data bit goes into
RB8 in Special Function register SCON, while the stop bit is ignored. The baud rate is
programmable to either 1/32 or 1/64 the oscillator frequency.
Mode 3: 11 bits are transmitted (through TXD) or received (through RXD): a start bit (0),
8 data bits (LSB first), a programmable 9th data bit and a stop bit (1). In fact, Mode 3 is
the same as Mode 2 in all respects except the baud rate. The baud rate in Mode 3 is
variable.
In all four modes, transmission is initiated in Mode 0 by the condition RI = 0 and REN =
1. Reception is initiated in Mde 0 by the condition RI = 0 and REN = 1. Reception is initi-
ated in the other modes by the incoming start bit if REN = 1.
Serial I/O port includes the following enhancements:
Framing error detection
Automatic address recognition
The serial port control and status register is the Special Function Register SCON,
shown in Table 2-17. This register contains not only the mode selection bits, but also the
9th data bit for transmit and receive (TB8 and RB8), and the serial port interrupts bits (TI
and RI).