Communication between the MCU and the PC. For example, the data collected by the MCU measurement and control system is sent to the host computer through the RS-232 interface. As shown in Figures 1 and 2. Usually, auxiliary software is required, such as Figure 3 serial port debugging assistant and Figure 4 host computer communication software.
Figure 1 MCU serial port connection
Figure 2 Communication between MCU and PC
Figure 3 Serial port debugging assistant
Figure 4 Host computer communication software
Example 1: Use serial port working mode 0 to expand an 8-bit parallel I/O port, where 74LS164 is a serial-input-parallel-output chip that drives the common-anode LED digital tube to display 0~9.
Answer: The basic principle of expansion is shown in Figure 5
Figure 5: Serial port mode 0 expansion
The encoding principle is shown in Figure 6.
Figure 6 LED coding principle diagram
The subroutine to display the numbers 0-9 is shown below.
DSPLY:MOV DPTR, #TABLE
MOVC A, @A+DPTR
MOV SBUF, A
JNB TI, $
CLR IT
RIGHT
TABLE:DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H;Digital codes from 0 to 9
Example 2: Dual-machine communication. As shown in Figure 7, connect two CS-III microcontroller experiment boards, set the baud rate to 9600, connect the TXD and RXD ports of the transmitter and receiver, connect the TXD port of the transmitter to the RXD port of the receiver, and the RXD port of the receiver to the TXD port of the transmitter, and connect the ground terminals of the two machines.
Figure 7 Schematic diagram of two-machine communication
Answer: Serial communication applications generally require the correct setting of the serial port working mode, calculation of the baud rate, initialization of the baud rate setting and serial port initialization, as well as related register settings. The serial communication flow chart is shown in Figure 8.
Figure 8 Two-machine communication flow chart
Previous article:System expansion of single chip microcomputer
Next article:MCU serial interface working mode
Recommended ReadingLatest update time:2024-11-16 13:55
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
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
- Wearable network design solutions based on Bluetooth and ZigBee technologies
- [Hua Diao Experience] 06 Building a Xingkong board development environment - Thonny programming
- The most comprehensive collection of circuit postgraduate entrance examination questions and tutorials, a benefit for postgraduate entrance examination candidates!
- GD32E231C_START ADC code evaluation
- TMS320F28335 project development record 11_28335 storage system
- Things you must know about Gallium Nitride (GaN): Technology (Part 2)!
- MC34063A step-down circuit chip cooling
- SinlinxA33 Simple QT control LED (io control)
- Can CycloneIII FPGA lock JTAG?
- "Playing with the board" + Yu Zhennan's STM32 development board experiment 3