1 Introduction
Some applications require temperature monitoring and require the temperature to be kept within a certain range. For example, the temperature of crop seedlings is 20℃~30℃, the temperature of poultry incubation is 37℃~40℃, and the temperature of bacterial strains is 23℃~28℃. However, the ordinary one-way over-temperature alarm is difficult to meet the requirements. Therefore, a two-way over-temperature control system design using temperature sensors and single-chip microcomputer application systems is proposed. The system design can display the temperature exceeding the lower limit or the upper limit, and the over-temperature point can be preset.
2 System Design Principles
Figure 1 shows the system design block diagram. First, input the upper and lower limits of the temperature change allowed through the keyboard. Under normal circumstances, the temperature should be kept between the upper and lower limits. When the temperature is higher than the upper limit, the temperature is lowered and an alarm is sounded; when the temperature is lower than the lower limit, the temperature is raised and an alarm is sounded.
The internal timer of the single-chip controller samples the temperature value once at a certain interval and generates a timer interrupt. The timer interrupt service program mainly compares the sampled temperature value with the set upper and lower temperature limits to determine whether the upper and lower temperature limits are reached, thereby deciding whether to increase or decrease the temperature and alarm, realizing two-way automatic temperature control, and can also realize fault alarm and change the upper and lower temperature limits through the keyboard.
Thermistors use semiconductor temperature sensing elements, which have negative resistance temperature characteristics. When the temperature rises, the resistance value decreases. To this end, a constant current is applied to the thermistor, the voltage across the resistor is measured, and then the temperature is obtained through the temperature measurement formula: T=T0-KUT, where T is the measured temperature, T0 is a temperature parameter related to the thermistor characteristics, K is a coefficient related to the thermistor characteristics, and UT is the voltage across the thermistor. K and T0 are constants. The voltage across the thermistor can be measured to calculate the ambient temperature of the thermistor. In this way, the change of resistance with temperature is converted into the change of voltage with temperature, and the voltage is then converted into a digital quantity by an A/D converter, and the temperature value is calculated by software.
3 Hardware Circuit
This system design is composed of AT89C2051 single chip microcomputer, AD574A, programmable keyboard and interface device 8279, temperature sensor, LED display, watchdog circuit, etc. [page]
3.1 AT89C2051 Microcontroller
AT89C2051 is a cost-effective 8-bit single-chip microcomputer produced by ATMEL. The device adopts the 80C31 core instruction system and is fully compatible with MCS-51. KB of Flash can be used as user program memory and 128 bytes of random access data memory (RAM); it contains 2 program encryption bits to prevent illegal reading of the program, and has good security; its low-voltage, high-performance CMOS 8-bit machine is compatible with MCS-51 instructions and output pins, forming a minimum measurement system; it has 20 pins, 15 bidirectional input/output (I/O) ports, of which P1 is a complete 8-bit bidirectional I/O port, 2 external interrupt ports, 2 16-bit programmable timer counters, 2 full-duplex serial communication ports, and 1 analog comparison amplifier; the clock frequency of AT89C2051 can be zero, that is, it has a sleep power saving function that can be set by software. The system wake-up methods include RAM, timer/counter, serial port and external interrupt port. After the system wakes up, it will enter the continuous working state; in power saving mode, the on-chip RAM is frozen, the clock stops oscillating, and all functions stop until the system is reset by hardware to continue running. Based on the many performances of AT89C2051, this system design uses AT89C2051 as the controller.
3.2 A/D Converter AD574A
This system design uses the 12-bit successive approximation A/D converter AD574A produced by ADI. AD574A contains high-precision reference voltage and clock circuit, has a small number of external components, low power consumption, and has functions such as automatic zero calibration and automatic polarity conversion, so that it can complete A/D conversion without any external circuit and clock signal, and its conversion time is 35μs.
3.3 Power-off protection circuit and watchdog circuit
In order to make the system work reliably and save the set data, the system needs to have a reset function. The power-off protection circuit and the system reset circuit use the MAX813L monitoring circuit to monitor the power supply voltage and the working status of the CPU in cooperation with the software. Once a crash occurs, the program "runs away" in an infinite loop, or the power supply voltage drops to the system setting value, the system needs to be reset. The connection between MAX813L and AT89C205l is shown in Figure 2. MR is grounded through a reset button. The main functions of the monitoring circuit are: system power-on reset, when the power supply voltage exceeds the reset threshold voltage of 4.65 V, the reset terminal can output a reset signal of 200 ms, and the system is reset; monitor the +5 V power supply: when the +5 V power supply is normal, RESET outputs a low level, and the microcontroller works normally; when the +5 V power supply voltage drops below +4.65 V, RESET outputs a high level, and the microcontroller is reset; the watchdog timer is cleared, and WDO maintains a high level: when the program "runs away" or crashes, the CPU cannot give a "feed the dog" signal within 1.6s, and WDO jumps to a low level. Since the MR end has an internal 250 mA pull-up current, D is turned on, MR obtains a valid low level, RESET outputs a reset pulse, the microcontroller is reset, the watchdog timer is cleared, and WDO returns to a high level. Manual reset: If you need to manually reset the system, just press the manual reset button to effectively reset the system. [page]
3.4 HD7279 Introduction
HD7279 can support 64-bit keyboard and 8-bit digital tube dynamic display. Compared with the traditional keyboard display device 8279, the number of peripheral components is small. The CS, CLK, DATA, and KEY signal lines of HD7279 are respectively connected to the P1.0~P1-3 ports of AT89C205l, and the P1.0~P1.3 port lines are time-division multiplexed, which greatly saves CPU I/0 port resources; HD7279 contains a decoder inside, which can directly receive BCD code or hexadecimal code, and has two decoding methods. In addition, it also has a variety of control instructions, such as left shift, right shift, flashing, blanking, segment addressing, etc.; it has the function of automatically eliminating key jitter and identifying key codes. There is no need for keyboard de-jitter program during software programming, and the control instructions of HD7279A make software programming simpler. Therefore, HD7279A is selected as the driver keyboard matrix. When scanning the keyboard, if a key is pressed, the key value typed can be displayed on the LED directly through the keyboard data reading instruction, without the need to control the keyboard input through the AT89C205l port line. The microcontroller receives the key value entered to control the sampled amount. HD7279 can be widely used in microcontrollers, smart meters, control panels and household appliances.
3.5 System Hardware Design
In Figure 3, AT89C205l's P1 is directly connected to the high 8-bit data line of AD574A, and the low 4-bit data line of AD574A is directly connected to the high half 4-bit P1.4~P1.7 of the single-chip computer. The data is read according to the control line of the single-chip computer. P3.4 is connected to the byte short cycle control line (A0) of AD574A, and P3.5 is connected to the read conversion data control pin (R/C). In this way, only 8 bits can be output, so the 12/8 data mode selection end is directly grounded, and the output control signal drives the temperature increase or decrease control circuit through the serial port P3.1 of the single-chip computer. The input mode of 10 V range is adopted, so the 10 VIN of AD574A is the input end of the measured voltage, and P3.6 of AT89C205l is connected to the chip select CS of AD574A. The converter is powered by ±12 V power supply voltage and the working voltage is +5 V. P3.7 outputs an alarm signal to drive a light-emitting diode to alarm. The working status indication signal terminal STS is connected to P3.2 of AT89C2051. When STS=1, the converter is in the conversion state; when STS=0, it indicates that the conversion is over. Therefore, the working state of the A/D converter is judged by this signal, which is used for the interrupt or query signal of the microcontroller. When P3.2 of AT89C2051 queries the conversion end signal of the STS terminal, the upper 8 bits of the converted 12-bit A/D data are first written to AT89C2051, and then the lower 4 bits are written. Regardless of the state of the AD574A in startup, conversion and output results, its enable terminal CE must be 1, so the CE terminal is connected to +5 V. When the above is the full control state of AD574A, the control process of its working state by CE, 12/8, CS, R/C and A0 of AD574A is as follows: [page]
分页When CE=1, CS=0, AD574A works normally; when AD574A is in working mode, A/D conversion is performed when R/C=0; data is read when R/C=1. 12/8 and AO are used to control the start conversion mode and data output format. When A0=0, it starts in full 12-bit data mode; when AO=1, it starts in 8-bit A/D conversion mode. When R/C=1, that is, when AD574A is in data state, A0 and 12/8 control the format of data output state. When 12/8=1, data is output in 12-bit parallel mode; when 12/8=0, data is output in 8-bit divided into two times. When AO=0, the high 8 bits of conversion data are output, and when AO=1, the low 4 bits of A/D conversion data are output. These 4 bits occupy the high half byte of 1 byte, and the low half byte is padded with zero. If AD574A is required to work in single mode, just connect CE and 12/8 to +5 V power supply, connect CS and A0 to 0V, and use R/C to control the start of A/D conversion and data output. When R/C=0, start the A/D converter. After 35μs, STS=1, indicating that the A/D conversion is completed. At this time, R/C is set to 1, and data can be read from the data terminal.
4 System Software Design
The system software design adopts a modular structure. The entire temperature measurement and control process consists of a main program, a temperature measurement subroutine, a timer interrupt subroutine, an A/D conversion program, a display subroutine, etc. Each module has only one entry and exit, and each module is independent of each other to avoid the entire system being paralyzed due to an abnormality in a certain functional module. Here only the main program flow chart (Figure 4) and the temperature measurement subroutine flow chart (Figure 5) are given.
5 Conclusion
The innovation of the system design is to use a thermistor with a temperature range of +10℃~+1.50℃. The resistor has the advantages of high sensitivity, small size, light weight, small thermal inertia, long life and low price. AT89C205l is a powerful single-chip microcomputer. It is suitable for electrical appliance control for energy saving and emission reduction and has a wide range of applications.
Previous article:Design of USB high-speed A/D data acquisition device based on C8051F060
Next article:Touch screen driver control based on C8051F020
Recommended ReadingLatest update time:2024-11-16 22:38
- Popular Resources
- Popular amplifiers
- Learning MCU Technology from Scratch (Liu Jianqing)
- Wireless doorbell alarm based on AT89C2051 single chip microcomputer
- Infrared remote control LED electronic clock using real-time clock chip DS1302+AT89C2051
- Infrared remote control LED electronic clock using real-time clock chip DS1302+AT89C2051.rar
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
- The principle of phase-locked loop frequency control
- [AutoChips AC7801x motor demo board evaluation] Development environment construction
- Arteli AT32F413 to AT32F415 Migration Guide_V1.0.0
- How to select components in the box?
- Showing off the i.MX6 development board
- [Xianji HPM6750 Review 10] Drawing a multi-function expansion board and verification
- About the distance of infrared obstacle avoidance circuit
- Repost - Tesla battery violent disassembly video
- Relationship between transformer and inductor
- How to port uCOS-II to LPC17XX