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.
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.
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.
Figure 2 LCD display circuit diagram
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.
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.
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.
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}
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
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
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.
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.
Previous article:Design of Boot-Loader for AT91SAM7Sxx Series MCU
Next article:Design of intelligent home anti-theft alarm system based on single chip microcomputer control
- Popular Resources
- Popular amplifiers
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- 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
- Looking for a company that can make SIC simulation models
- The volume control IC PT2259 has background noise, how to solve it?
- Learn about enhanced eCall car design in one article
- How to overcome the load-pull measurement challenges of 5G mmWave? (Part 2)
- [National Technology N32G430] 4GPIO inversion
- Computer World has been eliminated by the computer world! Do you still read paper magazines/newspapers?
- EEWORLD University - Getting Started from the Ground Up: Teach You How to Quickly Develop MSP430 Projects
- Free evaluation - Topmicro intelligent display module (1) Receive module
- TI has integrated it! CAN FD strengthens and upgrades automotive neural networks
- EEWORLD University - Key Considerations for Isolated CAN Transceivers