The structure of the serial port of 80C51
SBUF: Two physically independent receive and transmit buffers. They both occupy the same address 99H. The receiver is a double buffer structure, and the transmit buffer, because the CPU is active when sending, will not cause overlap errors.
80C51 serial port control register
1.SCON is a special function register used to set the serial port working mode, receive/send control and set status flags.
SM0 and SM1 are the operating mode selection bits (same as before), and four operating modes can be selected, as follows
RI (SCON.0), receive interrupt flag. In mode 0, when the serial reception of the 8th bit of data is completed; or in other modes, when the serial reception is in the middle of the stop bit, the internal hardware sets RI to 1 and sends an interrupt request to the CPU. In the interrupt service program, it is cleared to 0 by software to cancel this interrupt request.
TI (SCON.1), the transmit interrupt flag. In mode 0, when the serial transmission of the 8th bit of data is completed; or in other modes, when the serial transmission of the stop bit is in the middle, the internal hardware sets TI to 1 and sends an interrupt request to the CPU. In the interrupt service program, it is cleared to 0 by software to cancel the interrupt request.
RB8 (SCON.2), in mode 2 or mode 3, is the ninth bit of the received data, which can be set by software and used as the parity bit of the data. In multi-machine communication, it is used as the flag bit of the address frame and data frame. In mode 1, if SM2=0, RB8 is the received stop bit.
TB8 (SCON.3), in mode 2 or mode 3, is the ninth bit of the transmitted data, which can be set by software and used as the parity bit of the data. In multi-machine communication, it is used as the flag bit of the address frame and data frame. In mode 0 and mode 1, this bit is not used.
REN (SCON.4), serial reception enable bit. If software sets REN=1, the serial port starts receiving data. If software sets REN=0, reception is disabled.
SM2 (SCON.5), multi-machine communication control bit. Mainly used in mode 2 and mode 3. When the receiver's SM2=1, the received RB8 can be used to control whether to activate RI. (When RB8=0, RI is not activated and the received information is discarded; when RB8=1, RI is activated, the received data enters SBUF, and then the data is read from SBUF in the interrupt service). When the receiver's SM2=0, regardless of whether the received RB8 is 0 or 1, the received data can enter SBUF and activate RI (that is, RB8 does not have the function of controlling RI activation at this time). By controlling SM2, multi-machine communication can be achieved. In mode 0, SM2 must be 0. In mode 1, if SM2=1, RI is set to 1 only when a valid stop bit is received.
2. Only one SMOD bit in PCON is related to the serial port operation, as follows
SMOD (PCON.7), baud rate multiplication bit. In serial port mode 1, mode 2, mode 3, the baud rate is related to SMOD. When SMOD=1, the bit rate is doubled. When reset, SMOD=0.
Previous article:(Notes summary) How the 80C51 serial port works
Next article:(Notes Summary) The basis of computer serial communication
Recommended ReadingLatest update time:2024-11-16 12:01
- Popular Resources
- Popular amplifiers
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- How to read electrical control circuit diagrams (Classic best-selling books on electronics and electrical engineering) (Zheng Fengyi)
- MCU C language programming and Proteus simulation technology (Xu Aijun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Three failure modes of high-voltage connectors for new energy vehicles
- Is it necessary to take a shower for 10 minutes after a burn?
- Sensor Problems
- Latest solutions specifically for battery test equipment, 5G test equipment
- DCDC input capacitance waveform
- If anyone is willing to help improve the size of the building block library, we can share the profits in the future.
- EEWORLD University Hall ---- The second stop of the ADI Road theme tour of Shijian: Instruments
- The features of the SCI module are as follows (these functions can be set through the corresponding registers)
- How to implement a multi-protocol communication solution that meets Industry 4.0?
- A very basic question, how to understand the reading timing diagram?