Abstract:
In order to conduct online detection of parameters such as speed, pressure, flow, etc. in hydraulic equipment, we designed a comprehensive acquisition system for hydraulic engineering. This system uses the new single-chip microcomputer C8051F020 for multi-channel data acquisition and A/D conversion, and outputs it to a large-screen LCD color liquid crystal for data, curves, histograms, etc.; at the same time, the data is sent to the host computer through RS-485 communication, thereby realizing remote real-time monitoring of hydraulic equipment.
Keywords
: C8051F020, multi-channel, LCD display, serial communication
1. Introduction
In industrial control, it is necessary to collect various parameters, that is, to use the signal acquisition system to collect various data into the computer for real-time processing. The sensor plays the role of an intermediate bridge, but the signal it outputs is often a very weak current signal, which needs to be amplified and converted into a voltage signal before it can be input into the A/D for data acquisition. In addition, with the continuous development of testing technology, in order to adapt to the requirements of digitalization and high efficiency, the application of single-chip microcomputers in industrial testing systems is becoming more and more extensive. It has the advantages of real-time and high reliability, and is increasingly showing great superiority. This system uses the C8051F020 single-chip microcomputer of Cygnal Company in the United States as the control core, forming a multi-channel data comprehensive acquisition system, which uses fewer peripheral devices to realize the control of hydraulic equipment.
2. Introduction to C8051F020 MCU
The C8051F020 device is a fully integrated mixed-signal system-level MCU chip (SOC). It uses Cygnal's patented CIP-51 microcontroller core, which is fully compatible with the MCS-51 instruction set. It uses a pipeline structure, which greatly improves the instruction execution speed compared to the standard 8051 structure. CIP-51 provides 22 interrupt sources, allowing a large number of analog and digital peripherals to interrupt the microcontroller, thus having higher execution efficiency. It has 64 I/O pins, and each port can be configured as a push-pull or open-drain output. The C8051F020 MCU has an SMBUS/I²C interface, two full-duplex UARTs with enhanced baud rate configuration, and an enhanced SPI interface. Each serial bus is fully implemented in hardware and can generate interrupts to the CIP-51. It has a 12-bit ADC0 inside, which includes a 9-channel programmable analog multiplexer (AMUX0), a programmable gain amplifier (PGA0) and a 100ksps, 12-bit resolution successive approximation register ADC, which integrates a tracking and holding circuit and a programmable window detector; an 8-bit ADC1, including an 8-channel configurable analog multiplexer (AMUX1), a programmable gain amplifier (PGA1) and a 500ksps, 8-bit resolution successive approximation register ADC. Two 12-bit DAC converters, each DAC has a flexible output update mechanism, allowing seamless full-scale changes and supporting jitter-free output updates. The C8051F020 also has 5 general-purpose 16-bit timers and a programmable counter/timer array of 5 capture/compare modules.
3. System hardware structure
The multi-channel integrated acquisition system is based on the C8051F020 single-chip microcomputer and is mainly composed of the following parts: data acquisition, LCD display and data communication. Its hardware block diagram is shown in Figure 1. The current signal output by the sensor is amplified and converted, and then sent to the A/D converter inside the C8051F020. The analog-to-digital conversion, data storage and data processing are completed inside the single-chip microcomputer, and finally sent to the LCD display. At the same time, it is sent to the computer through the RS-485 interface and monitored in real time by the host computer.
Figure 1
3.1 Data Collection
For the 8 parameters to be tested in the hydraulic equipment, the corresponding sensors are selected for detection. During the test, the strain sensor is selected as the tool for the test site. The output of these selected detection elements is a standard 4-20mA weak current signal, which is converted into a 0-5V voltage signal through the amplification conversion circuit composed of LM324 and input into the analog input terminal of C8051F020, as shown in Figure 2, and converted into the corresponding digital quantity through the internal integrated A/D converter. C8051F020 stores the 8-way sampling values as the status of the hydraulic equipment site in the corresponding memory unit.
Figure 2
3.2 LCD Display
In order to make the data acquisition system compact and beautiful, and at the same time obtain a high cost performance, the DMF-50174 blue screen LCD produced by Depic is selected. The display is a 320×240 dot matrix LCD, which can display both graphics and text. The display driver control chip adopts a high-performance LCD controller SED1335 from EPSON. The hardware circuit adopts an indirect connection method, as shown in Figure 3. The P5.0~P5.7 port of the microcontroller is used as the input channel of the DB0~DB7 data bus of SED1335. P4.5 is used as the chip select signal of SED1335, and with the address signal A0, SED1335 receives instructions and data from the microcontroller through the data bus. When A0=0, P4.6 (WR)=0, P4.7 (RD)=1, the writing of instructions and the reading of data from SED1335 are realized. When A 0 = 1, P4.6 (WR) = 0, P4.7 (RD) = 1, it is the writing of display data. This function is realized by software.
Figure 3
3.3 Data Communication
TX0, RX0 and P0.2 of the single-chip microcomputer C8051F020 are connected to the host computer through MAX485 for serial communication, as shown in Figure 3. P0.2 controls the state or transmission of MAX485 and is controlled by software. RX0 is the serial input terminal of the single-chip microcomputer, which receives the data sent by the host computer to the single-chip microcomputer through MAX485. TX0 is the serial output terminal of the single-chip microcomputer, which is sent to the host computer through MAX485.
4 System Software Design
4.1 The software design generally consists of two parts: one is the microcontroller C8051F020
The main program design, part of which is the LCD display program design.
It can reduce the complexity of the program and improve the readability and modifiability of the program.
The software is programmed with C51 and compiled with the Keil µVision2 compiler.
The main program flow chart is shown in Figure 4.
4.11 Main Program
void main (void) {
long voltage; //voltage in mV
int i; //loop counter
WDTCN=0xde; //Disable watchdog timer
WDTCN=0xad;
SYSCLK_Init(); //Initialize the oscillator
PORT_Init(); //Initialize the data crossbar switch
UART0_Init(); //Initialize UART0
Timer3_Init(SYSCLK/SAMPLERATE0); //Initialize timer 3 overflow as sampling rate
ADC0_Init(); //Initialize ADC
AD0EN=1; //Enable ADC
EA=1; //Enable all interrupts
while(1){
for(i=0;i<8;i++)
{EA=0;
voltage=result[i]; //Get ADC value from global variable
EA=1;
voltage = voltage*VREF0; //Calculate voltage (mV)
voltage = voltage>>16;
LCD_Disp(); //Adjust the display program to display the voltage value
printf("Channl'%d' voltage is %ldmVn",i,voltage);//Serial port output
}}
5 Conclusion
In the test experiment, the sampling frequency of C8051F020 is defined as 50000Hz, ADC0 is set to the continuous conversion mode of timer 3 overflow, and the differential input method is used to form 8 conversion channels. After the microcontroller is running, data collection is performed by timer interrupt.
C8051F020 transmits the collected data to the host computer through the RS-485 interface. During the transmission, the baud rate must be consistent with the baud rate set by the PC, otherwise it cannot be received correctly. During the measurement process, the entire system works stably and the data can be displayed in "quasi" real time.
The innovation of the author of this article is that it can display the power P in the hydraulic system parameters in real time. In the past, hydraulic display devices could only display the pressure p and flow q of the liquid separately, and then use the formula P=pq to calculate the hydraulic power, which is rather troublesome. Moreover, the C8051F020 chip integrates a large number of peripherals and IO port resources. When designing the system, only a small number of peripheral chips are needed to complete the required functions, which simplifies the hardware circuit design, saves circuit board space, and reduces the size of the product. Therefore, this system has a broad application prospect.
References:
1. C8051F020/1/2/3 Mixed Signal ISP FLASH Microcontroller Data Sheet
2. Bao Kejin, Principle and Application of C8051F Single Chip Microcomputer, Beijing, China Electric Power Press, 2006.1
3. Tong Changfei, C8051F Series MCU Development and C Language Programming, Beijing, Beijing University of Aeronautics and Astronautics Press, 2005.1
4. Song Wei, Realization of Intelligent Temperature Measurement System Based on SMBus of C8051F, Microcomputer Information, Issue 12-2, 2005, Pages: P44-46
5. Yuan Tianyou, Multi-channel Signal Asynchronous Acquisition Technology Based on Single Chip Microcomputer, Microcomputer Information, Issue 4-2, 2006, Pages: P44-45
Previous article:Design of SD card main controller based on C8051F020
Next article:Zero-point correction technology of infrared axle temperature detector based on C8051F single-chip microcomputer
- 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
- Problems with frequency modulation using MAX2607
- Recruiting BLE software development engineers (with favorable treatment)
- Eliminating Software Failures with MSP432
- Op amp adder and subtractor
- Award-winning lecture: Nexperia Micro Classroom - Explanation of parameters in the power GaN device data sheet
- [Environmental Expert's Smart Watch] Part 12: Configuration of watch name and time
- [TI recommended course] #Boost and buck-boost DCDC converters help wireless charging design#
- Why does the servo motor make noise during operation?
- How to choose LoRa products
- [2022 Digi-Key Innovation Design Competition] Pi-hole Magical Uses of Pi400