Design of Monitoring and Controlling System for Multi-channel Parameter Changes Using C8051F000 Single-Chip Computer

In practical applications, controlling the physical parameters (temperature, humidity, displacement, current and voltage, etc.) of the controlled object within a certain range is one of the typical applications of single-chip microcomputers. In many occasions where precise control is required at the macro level, the micro control process can still be attributed to the control of the variation range of certain parameters. Such as the traditional three-phase asynchronous motor from start to normal operation, the change of current, voltage and temperature; the change of the water level of the pumping tower; the change of the stroke of the machine tool and the automatic range conversion of the digital meter. The most notable feature of these control processes is that the controlled physical quantities are all a range of variation, rather than a precise “point”

In practical applications, controlling the physical parameters (temperature, humidity, displacement, current and voltage, etc.) of the controlled object within a certain range is one of the typical applications of single-chip microcomputers. In many occasions where precise control is required at the macro level, the micro control process can still be attributed to the control of the variation range of certain parameters. Such as the traditional three-phase asynchronous motor from start to normal operation, the change of current, voltage and temperature; the change of the water level of the pumping tower; the change of the stroke of the machine tool and the automatic range conversion of the digital meter. The most notable feature of these control processes is that the controlled physical quantities are all a range of variation, rather than a precise “point”. There are many ways to effectively control the variation range of physical quantities. This article focuses on the hardware composition and software that use the C8051F000 single chip 8-channel high-performance 12-bit ADC data acquisition system and programmable window detector to realize the control of the multi-channel parameter variation range. design method.

1 Introduction of C8051FXXX series MCU

2 Hardware circuit composition and principle

The hardware circuit is shown in Figure 1, which is divided into three parts: data acquisition, key control and Display output. The 8 analog acquisition channels of the C8051FXXX series complete the data acquisition of the multi-channel parameters of the target system under test by selecting sensors or power conversion devices with different functions (such as current, voltage transformer, integrated temperature sensor, etc.). When working, the system constantly compares the data collected by each channel with the upper/lower limit values ​​set by the user in advance; the system executive agency determines whether the limit is exceeded and makes corresponding specific operations according to the comparison result. The system Display part is 5-digit LED display, the lower 4 digits are used to display the analog signal size of the channel selected by the user or the upper/lower limit value setting data, and the highest digit LED4 is the channel digital (0~7) display digit. P0.0~P0.7 are the output of over-limit processing of each channel, and control the corresponding actuators respectively.
 

Design of Monitoring and Controlling System for Multi-channel Parameter Changes Using C8051F000 Single-Chip Computer

2.1 Button control function

The key control part is the most complex part of the whole system and can best reflect the design idea. In order to easily select the channel and display the setting data, complete as many functions as possible with as few keys as possible, and achieve a better organic combination of human-machine interface and software and hardware resources, the “switch” key S1 for selecting the channel is set. The “set” key S5 for setting the upper/lower limit of the ADC window detector, the “+” and “-” keys S3 and S4 for changing the LED display data, and each press is required to increase (decrease) the displayed value by 1. If the continuous key press exceeds a certain time (such as 2s), the displayed value will increase or decrease rapidly. After the setting is completed, the user can press the “storage” key S2 to save the set data in the non-volatile data memory Flash, so as to avoid the trouble of resetting the data due to power failure. Through software design, the self-backup and protection of data is completed, no additional backup battery is needed, and the hardware structure is simplified.

2.2 How the ADC works and the window detector

In addition to integrating a multi-channel analog input selector (AMUX), programmable gain amplifier (PGA) and a 100Ksps, 12-bit resolution successive approximation ADC, the C8051F000 on-chip ADC subsystem also integrates a track-and-hold circuit and programmable window detector. They are completely controlled by CIP-51 through special function registers.

① ADC0CN register. Control the conversion start mode and the result data storage mode, set the ADC conversion end and the window detector interrupt flag, etc. A/D conversion allows triggering conversions with software events, hardware signals, or continuous conversions. After each conversion is completed, an interrupt is generated, or a software query is used to determine whether the conversion is complete. After completion, the data word is latched in the designated register.

② AMXOSL, AMOXOCF registers. ADC channel selection. When AMXOCF=00H, 00H~07H of AMXOSL means to select eight analog input channels AIN0~AIN7 respectively.

③ ADC0GTH ADC0GTL register. The two storage units are ADC programmable window detectors, which are 12-bit data registers for users to set the upper limit. ADC0GTH is the high four bits, ADC0GTL is the low eight bits.

④ ADC0LTH ADC0LTL register. The ADC programmable window detector is a 12-bit data register for the user to set the lower limit.

3 Software Design

In order to facilitate upgrade and maintenance, the software design adopts modular processing of building blocks, and each functional module is both interrelated and self-contained. Its basic design idea is: use the overflow of timer/counter T3 to start ADC conversion and window comparator interrupt regularly. Through interrupt processing, the 12-bit conversion data of the corresponding channel is compared with the upper/lower limit value set by the user as the over-limit condition, a new interrupt output is generated, and the system actuator is driven to adjust accordingly, so that the data is controlled. purposes within a certain range.

The main program is composed of software function modules such as initialization, display, timing comparison and key processing. Figure 2 is a flow chart of the main program.

Design of Monitoring and Controlling System for Multi-channel Parameter Changes Using C8051F000 Single-Chip Computer

Epilogue

Since Cygnal Company of the United States introduced C8051FXXX series MCU in 2000, the powerful internal functions and abundant on-chip resources enable it to realize the detection of multi-channel data range with the simplest hardware structure. The control system designed in this paper can be easily used in various power substation systems to control the range of three-phase current, voltage, etc., as long as the appropriate power sensor is configured.

The Links:   LQ043Y1LX01 MSP430G2755IRHA40R