Serial Communication in 8051 Microcontroller YASH PAL, April 13, 2026May 1, 2026 Serial Data Communication in 8051 Microcontroller – The 8051 microcontroller is able to support serial communication to make the system cost-effective for transmitting and receiving data bits serially. The 8051 microcontroller uses a register named SBUF to hold the data. This register comprises two registers. One is used to hold data to be sent out of the 8051 via a pin – TxD (P3.1).The other holds received data from the external source via a pin – RxD(P3.0). Both registers have the same internal address 99H. Register SCON (Serial Port Control) is used to control the data communication. It is an 8-bit special function register as shown in Figure 1. The SCON register can choose four programmable modes for serial communication.Table of Contents 8051 Microcontroller Serial Data CommunicationThe Serial Port Control (SCON) Special Function RegisterThe Interrupt Enable (IE) Special Function Register8051 Microcontroller Serial Data CommunicationThe 8051 microcontroller can be configured in one of the four modes for serial data communication. A programmer can select the mode by setting the mode bits SM0 and SM1 in the SCON register.Data Transmission – The transmission of data bits starts serially when the data byte that is to be transmitted is stored in the SBUF register. When transmission is completed, the T1 flag of the SCON register is set to indicate that SBUF is empty. An interrupt signal may be generated if more data has to be transmitted.Data Reception – The serial data reception is done on the pin RxD (P3.0). It starts when the REN bits of the SCON register are set for all operating modes. For mode 0, the R1 bit must be reset before reception starts. The R1 is set after receiving data in SBUF.Data Interruption – Whenever data communication is over, the corresponding flag of SCON gets set. For data transmission, the T1 flag gets set, whereas for data reception, the R1 flag gets set. These flags are ORed together to produce an interrupt to the program. The program must read these flags to determine which caused the interrupt and then clear the flag.The Serial Port Control (SCON) Special Function RegisterFigure 1: Serial port control (SCON) register DiagramBitSymbolFunction7SM0Serial port mode bit 0. Set/cleared by program to select mode.6SM1Serial port mode bit 1. Set/cleared by program to select mode.SM0 SM1 Mode Description 0 0 0 Shift register; baud = f/12 0 1 1 8-bit UART; baud = variable 1 0 2 9-bit UART; baud = f/32 or f/64 1 1 3 9-bit UART; baud = variable5SM2Multiprocessor communications bit. Set/cleared by program to enable multiprocessor communications in modes 2 and 3. When set to 1, an interrupt is generated if bit 9 of the received data is 1; no interrupt is generated if bit 9 is 0. If set to 1 for mode 1, no interrupt will be generated unless a valid stop bit is received. Clear to 0 if mode 0 is in use.4RENReceive enable bit. Set to 1 to enable reception; cleared to 0 to disable reception.3TB8Transmitted bit 8. Set/cleared by program in modes 2 and 3.2RB8Received bit 8. Bit 8 of received data in modes 2 and 3; stop bit in mode 1. Not used in mode 0;1TITransmit interrupt flag. Set to one at the end of bit 7 time in mode 0, and at the beginning of the stop bit for other modes. Must be cleared by the program.0RIReceive Interrupt flag. Set to one at the end of bit 7 time in mode 0, and halfway through the stop bit for other modes. Must be cleared by the program.Bit addressable as SCON.0 TO SCON.7To control the data rates, another special function register, PCON (Power Mode Control), is used. It is shown in Figure 2.The Interrupt Enable (IE) Special Function RegisterFigure 2: Power Mode Control (PCON) Register DiagramBitSymbolFunction7EAEnable the interrupt bit. Cleared to 0 by the program to disable all interrupts; set to 1 to permit individual interrupts to be enabled by their enable bits.6–Not implemented.5ET2Reserved for future use.4ESEnable serial port interrupt. Set to 1 by the program to enable the serial port interrupt; cleared to 0 to disable the serial port interrupt.3ET1Enable timer 1 overflow interrupt. Set to 1 by the program to enable timer 1 overflow interrupt; cleared to 0 to disable timer 1 overflow interrupt.2EX1Enable external interrupt 1. Set to 1 by the program to enable INT1 interrupt; cleared to 0 to disable INT1 interrupt.1ET0Enable timer 0 overflow interrupt. Set to 1 by the program to enable timer 0 overflow interrupt; cleared to 0 to disable timer 0 overflow interrupt.0EX0Enable external interrupt 0. Set to 1 by the program to enable the INT0 interrupt; cleared to 0 to disable the INT0 interrupt. Bit addressable as IE.0 to IE.7.Microprocessor Subject Tutorials & Notes | Beginners Guide engineering subjects Microprocessor microprocessor