1 Introduction
In practical applications, controlling the physical parameters (temperature, humidity, displacement, current, 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 range of changes of certain parameters. For example, the changes in current, voltage and temperature of a traditional three-phase asynchronous motor from startup to normal operation; the changes in the water level of a pumping tower; the changes in the stroke of a machine tool tool and the automatic range conversion of a digital meter. The most notable feature of these control processes is that the controlled physical quantity is a range of changes, rather than a precise "point". There are many ways to effectively control the range of changes in physical quantities. This article focuses on the hardware composition and software design method of using the 8-channel high-performance 12-bit ADC data acquisition system and programmable window detector in the C8051F000 single-chip microcomputer to achieve the control of the range of changes in multiple parameters.
2 Introduction to C8051Fxxx series single-chip microcomputers
Cygnal Corporation of the United States is an emerging semiconductor company specializing in the design and manufacture of mixed-signal system-on-chip microcomputers. The C8051Fxxx series is a mixed signal system on chip (System on Chip) based on the CIP-51 core, which is owned by the company and fully compatible with the MCS-51 core and instruction set. The chip integrates commonly used analog components in data acquisition and control systems, and can easily direct internal digital system resources to external I/O ports through digital cross switches. Its features are: up to 25 MIPS execution speed, powerful analog signal processing and resource control functions; 8-channel high-performance 12-bit ADC (maximum conversion rate of 100 kSPS) data acquisition system, two 12-bit precision DACs, two analog comparators and ADC programmable window detectors; 8K~128K bytes of flash/electrically erasable program memory, 256~8 448 bits of RAM; covers typical serial communication interfaces, 22 interrupt sources, 7 reset sources; advanced JTAG non-intrusive online debugging and reliable safety mechanisms such as watchdog and power monitoring. This product brings together many advanced technologies in the field of single-chip microcomputers, making it one of the most powerful 8-bit single-chip microcomputers at present.
3 Hardware circuit composition and principle
The hardware composition of the circuit is shown in Figure 1, which is divided into three parts: data acquisition, key control and display output. The 8-channel analog acquisition channel of the C8051Fxxx series can complete the data acquisition of multiple parameters of the target system under test by selecting sensors or power conversion devices with different functions (such as current, voltage transformers, integrated temperature sensors, etc.). When working, the system continuously compares the data collected from each channel with the upper and lower limit values set by the user in advance. The system actuator determines whether it exceeds the limit and makes corresponding operations based on the comparison results. The system is a 5-bit LED display. The lower 4 bits are used to display the analog signal size or upper and lower limit setting data of the channel selected by the user. The highest bit LED4 is the channel digital (0~7) display bit. P0.0~P0.7 are the over-limit processing outputs of each channel, which control the corresponding actuators respectively.
3.1 Key control function
This is the most complex part of the entire system, but it also best reflects the design concept. In order to conveniently select channels and display setting data, complete as many functions as possible with as few buttons as possible, and realize the organic combination of better human-machine interface and software and hardware resources, the "switch" key S1 for selecting channels, the "set" key S5 for setting the upper and lower limits of the ADC window detector, and the "+" and "-" keys S3 and S4 for changing the LED display data are set here, and it is required that each time it is pressed, the display value will increase (minus) 1. If the key is pressed continuously for more than a certain time (such as 2s), the display value will increase or decrease rapidly. After the user completes the setting, press the "save" key S2 to save the set data in the non-volatile data storage FLASH to avoid the need to reset the data due to power failure. The self-backup and protection of data is completed through software design, and there is no need to install a backup battery, which simplifies the hardware structure.
3.2 ADC working mode and window detector
The C8051F000 chip ADC subsystem integrates a multi-channel analog input selector (AMUX), a programmable gain amplifier (PGA) and a 100 kSPS, 12-bit resolution successive approximation ADC, as well as a track-and-hold circuit and a programmable window detector, which are completely controlled by CIP-51 through special function registers. ADC0CN register
: controls the conversion start mode and the result data storage mode, sets the ADC conversion end and window detector interrupt flags, etc. A/D conversion allows software events, hardware signals to trigger conversion or continuous conversion. After each conversion is completed, an interrupt is generated, or software query is used to determine whether the conversion is completed. After completion, the data word is locked in the specified register.
AMXOSL, AMXOCF register: ADC channel selection. When AMXOCF = 00H, AMXOSL from 00H to 07H respectively indicates the selection of eight analog input channels AIN0 to AIN7.
ADC0GTH, ADC0GTL registers: These two storage units are 12-bit data registers for the upper limit of the ADC programmable window detector set by the user. ADC0GTH is the high 4 bits, and ADC0GTL is the low 8 bits.
ADC0LTH, ADC0LTL registers: 12-bit data registers for the lower limit of the ADC programmable window detector set by the user.
4 Software Design
In order to facilitate future upgrades and maintenance, the software design adopts building block modular processing, and each functional module is both interconnected and self-contained. Its basic design idea is: using the overflow of the timer/counter T3 to start the ADC conversion and window comparator interrupt regularly. Through interrupt processing, the 12-bit conversion data of the corresponding channel is compared with the upper and lower limit extremes set by the user as the limit crossing condition, and a new interrupt output is generated to drive the system actuator to make corresponding adjustments, so as to achieve the purpose of controlling the data within a certain range.
The main program consists of software function modules such as initialization, display, timing comparison, and key processing. Figure 2 is a flowchart of the main program. Figure 3 is an interrupt processing subroutine. Only the main program list is given here, and all called subroutines are omitted.
LOOP0: ACALLWORK0; call the channel "switch" key processing subroutine. Allow users to select channels and display their upper and lower limit values
ACALL WORK1; call the "storage" key processing subroutine to save the user's setting value
in the FLASH of the unit after 8000H
ACALL WORK2; call the "+" key processing subroutine to realize the display data increment, with continuous addition function, convenient and fast adjustment
ACALL WORK3; call the "-" key processing subroutine to adjust the display data decrementally, with continuous subtraction function, convenient and fast adjustment
ACALLWORK4; call the "set" key processing subroutine. The user enters the extreme value setting state to realize the conversion of the upper and lower limit extreme value display ACALLDISP; call the display subroutine SJMPLOOP0
5 Conclusion
Since the C8051Fxxx series of microcontrollers were launched in 2000, their powerful internal functions and rich on-chip resources have enabled them to realize the detection of multi-channel data ranges with the simplest hardware structure. The control system designed in this paper can be conveniently used in various power substations to perform range control on three-phase current, voltage, etc. as long as it is equipped with appropriate power sensors to ensure the safe operation of the power grid, and has good promotion and application value.
1 Li Gang, Lin Ling. High-performance, high-speed single-chip microcomputer compatible with 8051 - C8051Fxxx. Beijing: Beijing University of Aeronautics and Astronautics Press, 2002 2 Xiao Dingbai. Application of LHB type AC transformer in household appliances. Electronic Technology, 1996 (12): 42
3 Gong Chenglong. Design of intelligent asynchronous motor integrated protector. Single-chip microcomputer and embedded system application, 2002 (2): 63-65
4 He Limin. Selection of single-chip microcomputer application technology. Beijing: Beijing University of Aeronautics and Astronautics Press, 1997
5 Pan Zhuojin, Shi Guojun. Principle and application of C8051Fxxx high-speed SOC single-chip microcomputer. Beijing: Beijing University of Aeronautics and Astronautics Press, 2002
6 Li Hua, et al. Practical interface technology of MCS-51 series single-chip microcomputer. Beijing: Beijing University of Aeronautics and Astronautics Press, 2002
Previous article:Design of Micro Electronic Piano Using Single Chip Microcomputer
Next article:8253 interrupt service program flow chart
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
- (Repost) Introduction to MOS tubes - only talk about applications, not principles
- What do these three lines in EMC mean?
- stm32g474 realizes 5 independent ADC synchronous sampling
- Classification and characteristics of power modules
- How to use the ratiometric characteristics of sensors and ADCs to improve accuracy
- Supercapacitors: Materials, Systems and Applications
- Skills required by MCU engineers and embedded engineers
- MSP430 clock system problem
- The more "flirty" serpentine traces on a PCB, the more "advanced" it is?
- Happy Dragon Boat Festival