Introduction: The serial port is a tool for the microcontroller to exchange information with the outside world.
There are two communication modes for 8051 microcontroller:
Parallel communication: data bits are sent or received at the same time. Serial communication: data bits are sent or received sequentially. See the figure below:
Serial communication method:
Asynchronous communication: It uses a start bit to indicate the beginning of a character and a stop bit to indicate the end of a character. The format of each frame is as follows:
In a frame format, there is a start bit 0 first, then 8 data bits, with the low bit first and the high bit last, followed by the parity bit (which can be omitted), and finally the stop bit 1. Using this format to represent characters, characters can be transmitted one by one.
In asynchronous communication, there must be two regulations between the CPU and the peripherals, namely, the character format and the baud rate. The character format is stipulated so that both parties can understand the same string of 0s and 1s as the same meaning. In principle, the character format can be freely determined by both parties in communication, but from the perspective of universality and convenience, it is generally better to use some standards, such as the ASCII standard.
Baud rate is the speed at which data is transmitted, and its definition is the number of bits of binary numbers transmitted per second. For example, if the data transmission rate is 120 characters/s, and each character contains 10 digits as specified above, the transmission baud rate is 1200 baud.
Synchronous communication: In synchronous communication, each character uses a start bit and a stop bit as a mark of the beginning and end of the character, which takes time; so when transferring data blocks, in order to increase the speed, these marks are often removed and synchronous transmission is used. Since the start of data block transfer must be indicated by a synchronization character, and a clock is required to achieve synchronization between the sender and the receiver, the hardware is more complex.
Communication direction: In serial communication, the one-way transmission method in which the communication interface can only send or receive is called simplex transmission; and the two-way transmission of data between two machines A and B is called duplex transmission. Duplex transmission is divided into half-duplex transmission and full-duplex transmission. Half-duplex transmission means that the two machines cannot send and receive at the same time, and can only send or receive information at any time.
Previous article:Serial interface structure and working mode setting register of 8051 single chip microcomputer
Next article:Program to generate continuous rectangular pulses using MCU timer T0 and P1.7 port
- Popular Resources
- Popular amplifiers
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
- The onboard microstrip antenna can completely replace the external IPEX antenna
- JTAG cannot recognize DSP processing
- What is a polarized relay?
- Reasonable use of NVM area
- Selection of chip beads and chip inductors
- How to put IAP at non-flash memory start address for Ateli AT32F403 microcontroller?
- 【Share】Choice of flyback chip
- Replace the foreign 2SK2837 field effect tube 500V, 24A model in AC-DC switching power supply!
- Program to control ad7708 with MSP430
- Fundamentals of RF/Microwave Switch Test System Design