1 Comparison between dedicated I/O chips and MCUs used as I/O chips
① The number of I/O ports of the dedicated I/O interface chip is not more than that of the single-chip microcomputer (the single-chip microcomputer model used by the author is 89C52);
② The dedicated I/O interface chip is not flexible to use. Several usage modes have been set by the chip designer and cannot be changed beyond this range. However, the single-chip microcomputer is less restricted and more flexible to use.
③ The dedicated I/O interface chip has poor independence and intelligence. Whether it is receiving input signals or outputting control signals, the I/O dedicated chip cannot make decisions on the input and output of signals. The decision must be made by the single-chip microcomputer. It only plays the role of relay or transition signal, has no monitoring ability, and cannot handle problems independently. However, the single-chip microcomputer is different and can flexibly handle problems in a variety of ways.
④ To use the I/O expansion chip, you must be familiar with it. Engineering technicians are generally much more familiar with the MCU than with it. In comparison, using it will waste time. In addition, the price of the I/O expansion chip is higher than that of the MCU, which is not economical from the cost accounting point of view;
⑤ The dedicated I/O chip has poor real-time performance. Since the dedicated I/O expansion chip only plays the role of sending and receiving signals and has no ability to process signals, the transmission of signals back and forth through it is bound to cause delays, resulting in poor real-time performance;
⑥Using single-chip microcomputer as I/O interface facilitates modularization of software and hardware design, with clear division of labor, which greatly facilitates design, debugging and maintenance;
⑦ Using a single-chip microcomputer as an I/O interface strengthens the supervision of the interface and reduces the burden on the main single-chip microcomputer.
2 Hardware structure and division of labor
The hardware design is divided into the following parts: single chip microcomputer; A/D conversion part; control signal output part; non-volatile memory (for RAM expansion); key part; display part; print I/O port part; analog switch part. The hardware structure diagram is shown in Figure 1.
Hardware design:
① The single-chip microcomputer uses 89C52, which has the characteristics of 8KB ROM inside the chip and does not require external ROM expansion;
②The A/D converter uses MC14433, which has the characteristics of high conversion accuracy and strong anti-interference ability. It can convert about 20 times per second. Because the liquid level changes not very quickly, it can meet the needs of monitoring liquid level changes;
③ The control signal output adopts the method of controlling 74LS373 latch by single chip microcomputer, so the number of control output ports can be increased or decreased by increasing or decreasing the number of latches;
④ Because each channel is required to be able to scroll and display the total input and output volume of each shift, day, and month within one year (3 shifts per day), and the data will not be lost in normal or unexpected power outages, the AT29LV040A (512KB) flash memory (FRAM can also be used) is used. Because the 89C52 can expand up to 64KB of RAM, in order to ensure sufficient storage space, the A16, A17, and A18 address lines of the AT29LV040A can be connected to a port of the 1# microcontroller. In this way, the purpose of using the 512KB space of the AT29LV040A can be achieved by controlling the changes of these three address lines.
⑤ The key part can use the conventional non-encoded keyboard method;
⑥ In order to improve the human-computer interaction ability, the display part adopts the GXM12864SL large-screen LCD, so that the screen can display self-edited Chinese characters, numbers, equations and simple patterns;
⑦ Print I/O port, you can make corresponding connection configuration according to requirements;
⑧The analog switches use multiple CD4051s, which work with the microcontroller to select the analog value of one of the multiple liquid level analog values, and then perform A/D conversion.
The selection of three single-chip microcomputers effectively solves the problem of insufficient I/O ports, and simplifies the design a lot. It only needs to follow the conventional chip connection method, eliminating many transition chips, such as 74LS244, 74LS245, 74LS73, etc., and also makes software design simple and easy. Because the hardware connection is simple and all are conventional connections, this article does not provide a detailed circuit connection diagram. The data exchange between the three single-chip microcomputers uses serial port communication, as shown in Figure 1. In this design, the three single-chip microcomputers are reset at the same time. Of course, they can also be reset separately, but the buttons need to be increased. This situation depends on the requirements.
3 Software Structure Design
Since the three MCUs are reset at the same time, they are in parallel working state after reset. The main work of 1# MCU is to convert all liquid level analog quantities into digital quantities and save them. It can transmit the collected and processed results to 2# MCU for display and 3# MCU for output control according to keyboard commands or system default format, or it can monitor only the liquid level changes of a specified one or several channels according to commands. The main work of 2# MCU is to read keyboard commands, issue commands to 1# and 3# after processing, and then display them on LCD according to feedback results. It can also continuously update its display content according to the data collected by 1# MCU. LCD display mode can be varied, it can cyclically display the specified liquid level of several channels, or fixedly display the liquid level of a channel, or cyclically display the input and output volume of each day or each shift of a certain day of a month, etc. The specific gravity of each liquid, calculation correction value, upper and lower limit height setting of liquid level, etc. can be input and saved through the keyboard. Passwords can also be set through the keyboard to prevent others or misoperation from destroying the set content. The input method should be designed so that there is no need to read the instructions, just follow the prompts on the LCD display to make the selection. The main work of the 3# microcontroller is to send control signals or print out results according to keyboard commands or data collected by the 1# microcontroller in a timely manner. The printout format can be selected according to the keyboard commands. The flowcharts of the three microcontrollers are shown in Figures 2, 3 and 4 respectively.
In addition to transmitting normal data and commands through the serial port, the three microcontrollers also need to monitor each other (this is difficult for I/O expansion chips to do).
① After the information is transmitted between each other, it must be verified, that is, the sender must receive the receiver's receipt in time;
② The three parties visit each other regularly to ensure that everything is going well;
③ In addition to self-checking, mutual checking is also required during each power-on reset.
The purpose of mutual supervision is to improve the performance of the entire system and facilitate system maintenance. 1# and 3# MCUs are equipped with two transmitting diodes to monitor whether the other two MCUs are working properly. 2# MCU itself has an LCD display and does not need a light-emitting diode. The serial communication interrupt service program, the sending program flow chart, and the timed mutual visit program flow chart are not given because they are relatively simple.
4 Debugging
In a system, using multiple MCUs to debug the entire system does bring some inconvenience. It is best to have as many MCU development devices as there are MCUs in the system, which is very helpful for debugging, because the status of each MCU can be checked at any time during debugging, but in reality there are usually only one MCU instead of multiple MCUs.
The program of each single-chip microcomputer is basically composed of two parts, one is an independent part that has no connection with other single-chip microcomputers, and the other is the part that communicates with each other between single-chip microcomputers (this part of the program is relatively small). When debugging, first debug the independent parts of each single-chip microcomputer, which will not be a problem for single-chip microcomputer application personnel. Then debug the serial communication program between single-chip microcomputers, first establish simple communication between each other, and after they can recognize and transmit data to each other, gradually add the complete program step by step. When designing and compiling a program, you should think about how to debug, so that when compiling a program, you will consciously divide the program into valid blocks, and you can debug it piece by piece when debugging. There are many debugging methods for multiple single-chip microcomputers, and this is just a one-sided view.
Conclusion
Using multiple microcontrollers in a liquid level monitoring system is an attempt, but it does simplify the system design, facilitates division of labor and collaboration among multiple people, and facilitates product improvement and updating. Its most significant effect is that it shortens the design, debugging and production cycle of the product.
Previous article:Design of intelligent window control system based on single chip microcomputer
Next article:51 MCU long key test program
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
- Design and production of "voice song request station" based on Raspberry Pi
- The light-off operation of the Nuvoton MCU assembly is invalid
- PD power supply detection and requirements
- High-paying job openings: A well-known American fashion brand of headphones is looking for electronic engineers, quality engineers, and firmware engineers who are fluent in English
- [National Technology N32G457 Review] OLED screen display driver and RTC electronic clock
- Things to note when writing programs based on TMS320 series DSP using C/C++
- "STM32 Library Development Practical Guide", a must-have for STM32 development!
- C language version of the time library function file or timestamp conversion algorithm
- To ensure the stability of electronic equipment, what tests need to be done on the hardware?
- Evaluation Weekly Report 20220801: Canaan K510 AI Development Kit is launched, and a domestic FPGA is expected to be launched this week~