8051 Architectural Specification and Functional Description
Function |
| Bit |
Flag | Location | |
Serial Port Operation | SMO | SCON.7 |
Mode (MSb) |
|
|
Serial Port Operation | SMI | SCON.6 |
Mode (LSb) |
|
|
Conditional Receiver | SM2 | SCON.5 |
Enable |
|
|
Receiver Enable | REN | SCON.4 |
Transmitter Data Bit 8 | TB8 | SCON.3 |
Received Data Bit 8 | RB8 | SCON.2 |
Transmission Complete | TI | SCON. I |
Interrupt Flag |
|
|
Reception Complete | RI | SCON.O |
Interrupt Flag |
|
|
Figure 2.49. Functions of Bits in SCaN
Mode control hits SMO and S M I program the serial port in one of four operating modes. A detailed description of the modes is. provided in section 2.12.2. The receiver- enable bit (REN) resets the receiver's start/stop logic. When software sets REN to one (1), the receiver's
The CPU is informed that the transmitter portion .of SB UF is empty or the receiver portion is full by TI and RI respectively. TI and RI must be cleared as part of the interrupt service program so as not to continuously interrupt the CPU. Since TI and RI are
2.12.2Operating Modes
2.12.2.1OPERATING MODE 0
The 1/0 expansion mode, Mode 0, is used to expand the number of input and output pins. In this mode, a clock output is provided for synchronizing the shifting of bits into or from an external register. Eight bits will be shifted out each time a data byte is written to the serial channel's data buffer (SBUF), even if TI is set. Each time software clears the RI flag, eight bits are shifted into SBUF before the RI flag is again set. The receiver must be enabled [i.e., REN set to one (I)] for reception to occur.
The synchronizing clock is output on pin P3.1 and toggles from high to low near the
following the instruction that updated SBUF. The first bit shifted in from P3.0 is latohed by the clock's rising- edge in the
2.12.2.2 OPERATING MODES
In the UART Modes (i.e., I through 3), the transmission rate is
Until a start bit arrives, the receiver samples the RXD input pin (P3.0) every "tick".
The contents of the receiver's input shift register is moved to SBUF and RB8 (Modes 2 and 3), and RI is set, when a frame's ninth (Mode 1) or tenth (Modes 2 and 3) bit is received. Upon reception of a second frame's ninth or tenth bit, the data bits in the shift register are again trans- ferred to SBUF and RB8, but only if software has reset the RI flag. If RI has not been reset, then overrun will occur since the shift register will continue to accept bits. Double buffering the receiver provides the CPU with one
Data is transmitted from the TXD output pin (P3.1) each time a byte is written to SBUF, even if TI is set. TI is set at the beginning of the transmitted tenth (Mode 1) or eleventh (Modes 2 or 3) bit. After TI becomes set, if SBUF is
In Modes 2 and 3, ifSM2isset, frames are received but an interrupt request is generated only when the received data bit 8 (RB8) is a one (1). This feature permits interrupt generated
31