(Notes Summary) Serial Port of 80C51

Publisher:老王古玩店Latest update time:2022-04-15 Source: eefocusKeywords:80C51 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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

image.png

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.

Keywords:80C51 Reference address:(Notes Summary) Serial Port of 80C51

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

80C51 series microcontroller hardware foundation
1. General introduction; A single-chip microcomputer is a large-scale integrated circuit chip. Nowadays, when introducing single-chip microcomputers, the MCS-51 single-chip microcomputer is generally used as the basis. When learning single-chip microcomputers, we learn from both hardware and software aspects. H
[Microcontroller]
80C51 series microcontroller hardware foundation
80C51 Original IP Core Internal RAM Expansion Solution
Introduction   The 80C51 series of single-chip microcomputers is a classic 8-bit microprocessor. Its design method and architecture have always been a reference model for the design of other types of single-chip microcomputers. Since its launch in the 1980s, it has been greatly developed and applied. To this day, a lar
[Microcontroller]
80C51 Original IP Core Internal RAM Expansion Solution
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号