Design of intelligent pneumatic pump control system based on C8051F020

Publisher:幸福如愿Latest update time:2011-05-22 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Introduction to the functions of C8051F020 MCU

The C8051F020 device is a fully integrated mixed-signal system-level MCU chip with 64 digital I/O pins. Its main features are: 1) High-speed, pipelined 8051-compatible CIP-51 core (up to 25MIPS); 2) Full-speed, non-intrusive in-system debug interface (on-chip); 3) True 12-bit, 100ks/s 8-channel ADC with PGA and analog multiplexer; 4) True 8-bit 500ks/s ADC with PGA and 8-channel analog multiplexer; 5) Two 12-bit DACs with programmable data update mode; 6) 64KB of in-system programmable FLASH memory; 7) 4352 (4096+256)B of on-chip RAM; 8) External data memory interface with addressable 64KB address space; 9) Hardware-implemented SPI, SMBus/I2C and two UART serial interfaces; 10) 5 general-purpose 16-bit timers; 11) Programmable counter/timer array with 5 capture/compare modules; 12) On-chip watchdog timer, VDD monitor and temperature sensor.

The C8051F020 with on-chip VDD monitor, watchdog timer and clock oscillator is a true stand-alone system-on-chip. All analog and digital peripherals can be enabled/disabled and configured by user firmware. The FLASH memory also has in-system reprogramming capability for non-volatile data storage and allows field updates of the 8051 firmware. On-chip JTAG debugging circuitry allows non-intrusive (no on-chip resources), full-speed, in-system debugging using the product MCU installed on the final application system. When using JTAG debugging, all analog and digital peripherals are fully functional. Each MCU can operate with a voltage of 2.7 to 3.6V within the industrial temperature range (-45 to +85°C). Port I/O, /RST and JTAG pins all allow 5V input signal voltage.

2. System working principle and structural design

The pneumatic pump control system should realize effective control of gas flow, including collecting gas flow information and controlling gas flow in real time. The control system is a monitoring and regulation system with a single-chip microcomputer as the core. It can independently complete the collection, processing and display of gas flow information, and can also communicate with the host computer through a standard RS-485 interface. The system principle structure block diagram is shown in Figure 1. It is a small distributed data acquisition and control system, which is mainly composed of a microcontroller, a gas flow sensor and its compensation bridge, a keyboard and a liquid crystal display module, an action actuator and a host computer.

System working principle diagram

Figure 1 System working principle diagram

The system uses C8051F020 as the microcontroller of the system. Its main functions are: 1) to sample the gas flow by setting its internal differential circuit; 2) to make judgments based on the two given flow limits (upper and lower limits) and give corresponding instructions to the action actuator; 3) to transmit the processed sampled flow to the LCD through the I/O port and to the host computer through the 485 bus.

The host computer will display the received sampled gas flow and two flow limits in real time to achieve real-time monitoring of the flow. The system also allows the upper and lower flow limits to be modified from the host computer.

The main functions of the keyboard and LCD display module are: the two flow limit values ​​can be modified through the keyboard; the LCD display will display the sampling flow, upper and lower flow limits, and the gas flow adjustment process.

The flow analog signal measured by the gas flow sensor is linearly compensated by a balanced bridge, and then sent to the A/D converter through a multi-way switch to be converted into a digital quantity and transmitted to the C8051F020 microcontroller.

The actuator mainly receives the command from the microcontroller, provides a signal to the system load, controls the opening size of the regulating valve, makes the actual flow gradually approach, reaches the given flow, and completes the automatic adjustment process. For example, when the sampled flow is lower than the upper limit, a signal is output to actuator 1; when it is higher than the upper limit, a control signal is output to actuator 2.

3. System hardware design

The hardware design of the system adopts a modular structure, which is compact and easy to debug and maintain. The system hardware circuit design includes four parts: single chip core control module, gas flow detection module, LCD display module, control execution module and communication module. [page]

3.1 MCU core control module

The design of the core control module of the single-chip microcomputer mainly includes the design of the minimum system of the C8051F020 single-chip microcomputer, the keyboard and the liquid crystal display circuit. Among them, AIN0.0 and AIN0.1 are used as the input terminals of the gas flow sampling; P0.0 and P0.1 provide input/output signals for communication; P1 port is used as the keyboard lead-out terminal; some pins of P6 port and P5 port are used as the data port and control port of the liquid crystal; P2.4 and P2.5 are used as the control signal output terminals of the executable mechanism 1 and 2 respectively. The CGM12864B dot matrix liquid crystal display screen is composed of two column drive circuits KS0108 with controllers and one row drive circuit KS0107, which are the main hardware circuits. The display is composed of a 128×64 pixel liquid crystal chip. KS0108 divides the display area into left and right half screens, and the entire screen is divided into 8 pages with 64 rows from top to bottom, and each page has 8 rows. Its liquid crystal display circuit is shown in Figure 2.

LCD display circuit diagram

Figure 2 LCD display circuit diagram [page]

3.2 Gas flow detection module

The module is mainly composed of gas flow sensor, shaping amplifier circuit, multi-way switch and A/D converter circuit, etc. It mainly completes the shaping and amplification of the analog quantity corresponding to the gas flow detected by the sensor, and converts it into a digital quantity that can be received by the C8051F020 single chip microcomputer.

When the measured gas passes through the flowmeter within the specified flow rate and pressure range, its instantaneous volume flow rate Qi is

Qi=N/ξi (1)

Where N is the number of pulses output within 1s; ξi is the flow meter coefficient.

When detecting gas flow, the CPU internal timer/counter CTC1 continuously samples the number of pulses output by the flow meter, and calculates the measured flow once per second through hardware interrupts to obtain the instantaneous volume flow Qi and cumulative volume flow Qv of the measured gas.

3.3 Control Execution Module

The main function of the control execution module is to control external auxiliary equipment, such as air compressors. The external circuit interface of this system can be easily connected to the external circuit through a triode circuit. The circuit diagram of the single-chip microcomputer controlling the external relay is shown in Figure 3.

Relay circuit diagram

Figure 3 Relay circuit diagram

3.4 Communication Module

In order to achieve long-distance effective data communication between the single-chip microcomputer and the host computer, the communication module uses the MAX485 chip, which is designed according to the RS485 standard. P0.0 and P0.1 of the P0 port are configured as TX0 and RX0 pins, which are connected to RO and DI of the MAX485. Since the microcomputer serial port uses the RS232 standard and the single-chip microcomputer serial port output is the TTL standard, the conversion between standard signals must be realized. The circuit design is shown in Figure 4.

RS485 communication circuit diagram

Figure 4 RS485 communication circuit diagram

3.5. Gas flow control

On the basis of gas flow measurement, the deviation is calculated after comparing the given value with the actual measured instantaneous flow, and then the gas flow is adjusted. Since the accurate mathematical model of the gas flow system is difficult to obtain, the fuzzy control algorithm has the characteristics of human intelligent thinking, good adaptability, and strong robustness, which is suitable for such systems. Therefore, the use of fuzzy control algorithm to automatically control the gas flow can achieve good control characteristics, and its fuzzy controller block diagram is shown in Figure 5.

Fuzzy Controller Block Diagram

Figure 5 Block diagram of fuzzy controller

The fuzzy controller adopts a two-dimensional structure with dual input and single output. The input variables are instantaneous flow deviation e and deviation change c, and the output variable is the control variable u. Its fuzzy subsets are

E={NL, NM, NS, NO, PO, PS, PM, PL}

C={NL, NM, NS, O, PS, PM, PL}

U={NL, NM, NS, O, PS, PM, PL}

Their domains are

E={-6,-5,-4,-3,-2,-1,-0, +0, 1, 2, 3, 4, 5, 6}

C={-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6}

U={-7,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7}[page]

When the instantaneous flow rate changes, the regulating valve is driven to control its opening size and change law so that the deviation approaches zero. According to the parameter characteristics of gas flow, actual operation experience on site and the knowledge theory of experts, the fuzzy control rule table is summarized, as shown in Table 1.

Table 1 Fuzzy control rules table

Fuzzy control rules table

The selection of fuzzy control rules is the key issue of fuzzy controller. In order to better improve the control accuracy, this system adopts a control rule with 4 adjustment factors:

Among them, 0<α1<α2<α3<α4<1, this system chooses: α1=0.26, α2=0.58, α3=0.76, α4=0.86. After substituting into the above formula and repeated modification and actual debugging, a practical fuzzy control query table is obtained, as shown in Table 2.

Table 2 Query table

Query Table

4. System software design and anti-interference measures

The software design includes the design of the system's lower computer and upper computer.

4.1 Lower computer program design

The lower computer program mainly performs the initialization of the C8051F020 single-chip microcomputer system, port configuration, A/D initialization, LCD and keyboard scanning initialization. In order to prevent malfunction and inadvertent change of system parameters, resulting in human measurement errors, the system can set a "password" to ensure the reliability and accuracy of the measurement. The specific process is shown in Figure 6.

flow chart

Figure 6 Flowchart

The control algorithm in fuzzy control is implemented by the program. It includes two parts: one is to calculate the fuzzy control query table offline, and the other is to input variables online in the real-time control process, and perform fuzzy quantization on them, and then look up the fuzzy control query table and output it to control the opening angle of the regulating valve to achieve the control of gas flow.

3.2 Host computer part

The upper computer program is designed using Lab Windows/CVI, which mainly realizes the reception and display of the sampled gas flow and two flow limit values. It can also modify the flow limit values ​​and send them to the lower computer.

3.3 Anti-interference measures

In order to improve the stability of the control system and enhance its anti-interference capability, an isolated power transformer can be used, and the signal channel can adopt photoelectric isolation and filtering technology; Watchdog technology and software traps can be used to prevent the program from running away and realize task recovery; and power supply anti-interference measures can be taken.

Reference address:Design of intelligent pneumatic pump control system based on C8051F020

Previous article:Design of four-character LED display based on AT89C2051
Next article:Solution of driving OLED display based on SSD1303 and AT89C51

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号