0 Introduction
In modern industrial control systems, multi-parameter real-time acquisition plays a very important role in the normal operation of monitoring equipment. Multi-parameter signal acquisition is to convert the physical quantity, chemical quantity or biological quantity of the monitoring site into an analog voltage signal that is easy to collect and process through the corresponding sensor and conditioning circuit. After processing by the single-chip microcomputer, it is fed back to the control component to control and adjust the monitored object on the one hand, and sent to the display unit on the other hand to display the collected signal data in real time. In the control fields of aviation, automobiles, communications, gardening, etc., multi-parameter real-time acquisition and processing is the core of the automatic control system. However, the price of dedicated data acquisition equipment is tens of thousands of yuan, and the price of high-speed data acquisition cards is also more than one thousand yuan. Moreover, most of these devices have fixed interfaces and cannot adapt to the needs of the various objects being measured, and are not universal. From the application perspective, this paper designs a real-time data acquisition system with a resolution of 8 bits. With the support of the STC_ISP_V394 software environment, the collected parameters are displayed in real time on a PC. The lower computer uses AT89C52 single-chip microcomputer as the control unit, and the 8-channel A/D conversion chip ADC0809 collects two voltage signals: channel 0 is sampled once every 1s, for a total of 10 times; channel 1 is sampled once every 5s, for a total of 20 times. The collected data is sent to the upper computer via serial communication for real-time display. This system uses different sensors to replace the collection of two voltage signals, which is suitable for various control circuits and has strong versatility.
1 System hardware design
The data acquisition and processing system is divided into five units: single-chip main control module, A/D conversion module, digital tube display module, keyboard control module and serial communication module. The system composition block diagram is shown in Figure 1.
1.1 A/D conversion module
The analog-to-digital conversion uses the commonly used chip ADC0809, which has an 8-channel multiplexer inside. Since there is only one converter inside, the 8-channel analog signals can only be converted in time-sharing. According to the signal decoded by the latch address line, only one of the 8 analog input signals is selected at a time, and the analog-to-digital conversion is performed based on the principle of successive approximation. The conversion time is 100μs and the conversion accuracy is 8 bits.
[page]
The internal structure of ADC0809 is shown in Figure 2. To start ADC0809 for A/D conversion, first input a 3-bit address signal and make ALE high, store the address in the address latch, and select one of the 8 analog inputs to the comparator after decoding by the decoder; the rising edge of START will gradually approach the register reset, and the falling edge starts the A/D conversion. The EOC output signal becomes low, indicating that the conversion is in progress. Until EOC becomes high, it means that the A/D conversion is over, and the conversion result is stored in the latch. When the OE input is high, the output tri-state gate opens, and the digital quantity of the conversion result is output to the data bus.
1.2 Keyboard and display module
The human-computer interaction of the parameter acquisition and processing system adopts a 2×8 matrix keyboard and a static digital tube display, as shown in Figure 3. In order to save the I/O port line of the single-chip microcomputer, the human-computer interaction adopts two-line control, and the analog switch CD4052 is used to switch and control the data signals of the keyboard and digital tube.
1.3 Serial communication module
Since the microcontroller and PC use different logic levels, when designing the serial interface circuit, it is necessary to consider the level matching, drive capability matching, component selection and other electrical characteristics. PCs usually have two standard RS232 serial ports. In order to improve the anti-interference ability, this interface uses EIA level logic, as shown in Table 1.
In order to achieve level compatibility between the microcontroller and the PC, the microcontroller must go through level conversion when communicating with the PC. Usually, MCl488 and MCl489 chips are used to achieve level conversion, but the circuit structure of these two conversion chips is complex, the power supply requires ±12V power supply, the operation is unstable, and the chip is easy to burn out. This design uses the MAX232 integrated circuit chip, which is only powered by +5V. It has two sets of voltage conversion circuits inside, and the peripheral circuit is equipped with 4 boost capacitors to achieve mutual conversion between EIA level and TTL level. It has the characteristics of simple circuit structure, small number of components, single power supply, low power consumption, etc. The serial interface circuit composed of the MAX232 chip is shown in Figure 4.
The AT89C52 microcontroller has a programmable, full-duplex serial port. During communication, the serial data received and sent can be exchanged through the serial data buffer SUBF of the special function register SFR, so it can be used for multi-machine communication, especially suitable for communication between the terminal and the system host.
1.4 Microcontroller and A/D interface module
The microcontroller uses the AT89C52 microcontroller produced by ATMEL. It is manufactured using advanced technology, has a high-performance MCS51 core design, and has a non-volatile Flash program memory. It is a high-performance, low-power 8-bit CMOS microprocessor chip with a wide range of market applications. It has great advantages in realizing signal acquisition, data processing, serial transmission, real-time control, etc.
This design uses the query method to collect data and reasonably allocates the resources of the microcontroller. Most of the time, the microcontroller is used to run the control program, and only when the acquisition time comes, the microcontroller is used to execute the acquisition program. Figure 5 shows the interface circuit between ADC0809 and the microcontroller. When data needs to be collected, the microcontroller first outputs the address signal to specify the channel for collection, then makes ALE and START high to start A/D conversion, and then the microcontroller handles other matters, and later checks whether EOC is high. If it is high, the conversion is completed. When the conversion result needs to be read, a read command is sent to make OE high to read the conversion result and store it in the specified unit for display on the digital tube and upload to the PC.
[page]
2 System software design
The system software mainly includes: system initialization, key judgment program, AD conversion program, digital tube display program and serial communication program. Figure 6 is the program structure block diagram.
The single chip uses 11.0592MHz crystal oscillator, the timer selects working mode 2, the serial port works in mode 1, and the baud rate is set to 9600. The host PC uses the "Serial Debug Assistant" function in the STC_ISP_V394 development environment to receive serial data and display the acquisition results. Figure 7 is the STC_ISP_V394 data acquisition interface, which shows the real-time acquisition results of the two voltage signals.
MCU serial communication initialization settings:
MOV TMOD, #20H: T1 working mode 2
MOV THl, #0FDH: baud rate 9600
MOV SCON, #40H: serial port working mode 1
SETB TR1: open timer 1
MCU sends data:
MOV SBUF, A: send the received data to the PC
JNBTI, S
CLR TI
3 Conclusion
This paper introduces a method for implementing data acquisition and serial communication interface based on A/D conversion chip ADC0809 and AT89C52 microcontroller. This design is debugged on a self-made development machine. The self-made development machine uses STC89C54 microcontroller with ISP online programming function. Program download and data communication are completed in the STC_ISP_V394 development environment. It has been verified in practice that it has a good effect in short-distance transmission, and no data loss or error occurs during transmission. Data acquisition and serial data transmission are very important in industrial control. This design has general versatility. Readers can improve it according to their actual needs to meet the needs of engineering design.
Previous article:Design of dimming controller based on 51 single chip microcomputer
Next article:Design of intelligent management system for nickel-cadmium rechargeable batteries based on single chip microcomputer
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
- Help
- Failed experience of using BlueNRG-1 to make a BLE chicken-eating tool
- Exploiting software vulnerabilities! 19-year-old boy remotely hacked into Tesla
- Gizwits GoKit 3 Hardware Manual
- TMS320C6678 ZYNQ Dual-core ARM Communication Case Development Manual - matrix_multiply Case
- Monochrome screen upgrade: How to quickly upgrade the DWIN T5UIC1 color screen
- Intelligent management tools used by power operation and maintenance personnel
- Precautions for using C/C++ language to write programs based on TMS320 series DSP
- [Automatic clock-in walking timing system based on face recognition] K210 MAIXBIT uses QR code recognition as user information
- Several types of Bluetooth antennas are summarized. Which one is more familiar with Bluetooth signals? Which type of Bluetooth is used for the same chip...