There are two ways of computer data exchange: serial communication and parallel communication.
Parallel communication: Let's take 8 bits (one byte) of data as an example. Under parallel communication, 8 bits of data are transmitted at the same time, sent and received at the same time. Therefore, both parties in communication need a common clock signal. Parallel transmission is fast and efficient. However, it requires more data lines and a shorter transmission distance.
Serial communication: Still taking 8-bit data as an example, each bit of data is sent in time-sharing, and the receiver also receives it one bit at a time. Serial communication only requires one data line, which is low-cost. It is suitable for large-scale and long-distance data transmission.
Asynchronous transfer mode: Each transmitted character is wrapped with a start bit and a stop bit, and gaps of varying lengths are allowed between characters.
Synchronous transmission mode: A data block contains many consecutive characters, with no idle time between characters. Synchronous transmission can easily implement the format required by a certain communication protocol.
Baud rate: Here it is defined as the number of "bits" transmitted per second in serial communication. That is, n baud = nb/s. In the RS-232C standard, the baud rate of serial communication is specified as follows: 600, 1200, 2400, 4800, 9600, etc.
Calculation of the baud rate of the serial port:
In mode 0, the baud rate is fixed at: F/12 (F is the crystal frequency)
In mode 2, the baud rate is fixed to: F/32 or F/64 (depending on the SMOD bit of the PCON register, if SMOD = 1, it is F/32; otherwise it is F/64).
Mode 1 and Mode 3: The overflow rate of the T1 timer is used as the baud rate generator, so the calculation formula is:
K*F/[32*12*(2^n - X)].
If SMOD = 1, then K = 2, otherwise K = 1, F is the crystal frequency, n is the number of bits in the timer (that is, which working mode the timer is in), and X is the initial value filled by the timer.
In serial communication, both parties are required to have the same baud rate, but sometimes we cannot reach that baud rate accurately. At this time, we need to consider which of the two cases, SMOD = 1 and SMOD = 0, produces a smaller relative error, and we will choose that one.
Relative error = (actual value - theoretical value) / theoretical value * 100%
Previous article:Memory expansion of 51 single chip microcomputer
Next article:8051 MCU External Interrupt Programming Example
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Seek guidance from the experts and find routines.
- Qorvo at CES 2020: Innovative Solutions for 5G, IoT, Wi-Fi 6 and V2X
- Write down your most sincere New Year's wishes and win 66 points
- MCH2022 Badge
- Logic-Buffer
- Application of Dacai UART screen in multi-functional intelligent disinfection cabinet
- EEWORLD University ---- [High Precision Laboratory] Multiplexer
- [Xianji HPM6750 Review] + Hardware IIC reads the temperature and humidity sensor values
- Sensor PCB layout
- 【GD32E231_DIY】③. Debugging OLED and DS1302 modules