Design of AT89C2051 Bidirectional Temperature Monitoring System

Publisher:温馨生活Latest update time:2011-07-27 Keywords:AT89C2051 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Design of AT89C2051 Bidirectional Temperature Monitoring System

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]

分页 Design of AT89C2051 Bidirectional Temperature Monitoring System

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.

Design of AT89C2051 Bidirectional Temperature Monitoring System

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.

Keywords:AT89C2051 Reference address:Design of AT89C2051 Bidirectional Temperature Monitoring System

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

Design of remote current data acquisition system based on power line carrier technology
Introduction: This paper introduces a remote current data acquisition system using semiconductor magnetoresistive current sensor (MRCS) and LM1893 chip. The system hardware mainly consists of AT89C2051 single-chip microcomputer main control circuit, serial ADC0832 analog/digital conversion circuit, LM1893 power line c
[Microcontroller]
Design of remote current data acquisition system based on power line carrier technology
Kitchen timer based on AT89C2051 microcontroller
The device uses 5 minutes as a timing unit and can last up to 1 hour. It uses a 3V battery as the power source and has a buzzer alarm. The power consumption is about 6mA when working (using AT89C2051). It can use a 3V button battery and has an automatic shutdown function. The power consumption is negligible when not
[Industrial Control]
Kitchen timer based on AT89C2051 microcontroller
How to make a countdown timer using AT89C2051 microcontroller
The countdown timer is very useful in daily life. It is made by using a microcontroller. Not only the circuit is simple, but the functions can be designed according to the needs. There are many countdown timers designed by 74 series and 40 series small-scale digital chips, but they have shortcomings such as unintuitiv
[Microcontroller]
How to make a countdown timer using AT89C2051 microcontroller
Electronic clock (DS1302+AT89C2051 infrared remote control clock)
;Data code of each button of the remote control, the corresponding key code can be modified according to different remote controls muteM EQU 10h ;Mute key alarm on/off timerT EQU 0Ch ;Menu key enter/exit setting state leftL EQU 46h ;Left shift key  rightR EQU 47h ;Right shift key upU EQU 19h ;Increase key downD EQU 1d
[Microcontroller]
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号