Design and implementation of digital thermometer based on STC89C58

Publisher:painterLatest update time:2011-06-10 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Introduction
With the development of the times, digital control is undoubtedly one of the goals pursued by people, and the convenience it brings to people is also undeniable. Among them, digital thermometer is a typical example. It is widely used in many fields such as information, electronics, logistics, etc. As people's requirements for it become higher and higher, in order to provide better and more convenient facilities for modern people's work, scientific research, and life, it is necessary to start from single-chip microcomputer technology and develop in the direction of digital and intelligent control.
Here we introduce a design and production plan for a digital thermometer. The design controller uses the single-chip microcomputer STC89C58, the temperature sensor uses LM94022, and the temperature display is realized by the FM1602C liquid crystal display. The wide-range high-precision multifunctional digital thermometer is designed and produced to accurately meet various requirements. Compared with traditional thermometers, the digital thermometer designed and developed in this paper has the characteristics of convenient reading, wide temperature measurement range, and accurate temperature measurement. Its output temperature and time are displayed digitally. The digital thermometer not only has high resolution, but also can set the upper and lower limits of the alarm temperature. When the temperature reaches the high and low limit temperature control points, an audible and visual alarm is issued. This equipment is mainly used in places or scientific research laboratories where temperature measurement is relatively accurate.

1 Demonstration and comparison of system design schemes
1.1 Using LED digital tubes to display and using LCD liquid crystal to display temperature and time The
use of LED display provides less information, the interface is not beautiful, it is extremely inconvenient to display time and temperature, and the volume is large. When more information is to be expressed (such as two-way temperature value and time), a large number of LEDs and more pins are required, and the software design is relatively complex.
LCD can provide a stronger page display function, low power consumption, and the page is more intuitive and clearer than LED display; when displaying more information, it occupies less space than LED and has a higher cost performance.
It is easy to see that it is better to use LCD as a display in this design.

2.2 Sensitivity selection terminals GS0 and GS1
LM94022 has 4 sensitivities for users to choose from according to the different levels applied to GS0 and GS1, as shown in Table 2. Users can choose reasonably according to the temperature measurement range and the working voltage conditions of the interface circuit. The sensitivity is determined by the levels of GS0 and GS1. The high level requires VDD>1.5 V; the low level requires VDD<0.5 V.

2.3 Output Characteristics of LM94022
The output characteristics of LM94022 are shown in Figure 2, which is the characteristic of measuring temperature and output voltage at different sensitivities. Since the output voltage decreases with increasing temperature, its sensitivity is negative. When VDD = 5 V, the output voltage at several specific temperature values ​​at different sensitivities is shown in Table 2 (typical values).


The overall scheme of the digital thermometer circuit design is shown in Figure 3. The STC89C58 microcontroller is used as the main control device; the LCD uses FM1602, and P0 in the microcontroller is used as its interface, and is controlled by P2.5~P2.7 to drive the LCD display; the clock chip uses DS1302, and pins P2.2~P2.4 are used as clock chip control pins; LM94022 is used as the temperature sensor chip, and TLC2543 is used to convert it into a digital signal, and P3.2~P3.6 are used as ADC control pins; P1 port is used as the keyboard input port to receive the signal output by the keyboard; P2.1 and P2.0 are used as the alarm control pins for over-temperature and under-temperature, respectively, and P3.7 is used as the buzzer control pin.

3.1 Temperature sampling
LM94022 adopts "10" mode. In the range of 0-100℃, the conversion formula is used:
T=(1 568-V)×0.122 699 38
pairs of output voltage samples (using op amp LM2015 as voltage follower) and converted by ADC, extracted by the microcontroller, calculated and converted into temperature.
3.2 Clock
circuit The clock uses a backup battery. After the time is set for the first time, the stored information will not be lost. When the circuit is started next time, there is no need to set the time again, which is convenient to use.
3.3 Human-computer exchange circuit
The system uses a keyboard as a human-computer exchanger, and the 4×4 structure is shown in Figure 4. Among them, Time is used for time setting; L-tem and H-tem are used for low temperature and high temperature settings respectively; Return is used to return to the main interface.

3.4 Reset function
When the reset button is pressed, the system is initialized, the low temperature of the system is set to 0.0℃, and the high temperature is set to 90.0℃.
3.5 Display interface
The first line shows the time, and the second line shows the temperature of the first and second channels. When an emergency occurs, the second line shows the reason, and the first line shows which channel has an error, and there will be a buzzer and LED light prompt.
3.6 Data storage
The hardware storage function is not implemented. Due to some minor problems in the division of labor, the software and hardware are not properly combined, the design is out of touch, and the storage function is ultimately not implemented.

4 System software design
The system software consists of three modules: main program module, function realization module and operation control module.
4.1 Main program flow
After the system is powered on and reset, it is initialized: select T0 interrupt (working mode 1) and set the initial value of the timer, initialize the temperature test circuit, and initialize the display circuit. If a key is pressed, disable T0 interrupt and display the interface for processing the corresponding event. After processing the event, press the Return key, T0 interrupt is reopened, and the normal temperature display interface is returned; if no key is pressed, if T0 interrupts, the temperature value is updated, as shown in Figure 5.

4.2 Display update program flow
Figure 6 is a flow chart of the display update program. If T0 is interrupted, the temperature value is read and updated, and the temperature update time is 50 ms. The newly read temperature value is processed. If it is higher or lower than the set temperature value, an alarm is issued and the corresponding diode lights up. Finally, the temperature information and time are read and displayed.

5 Test and result analysis
5.1 System debugging parameter analysis
Test instruments: multimeter, heating instrument.
The program simulation was used, and it was simulated on the computer software in advance and then downloaded to the microcontroller. Due to time constraints, some hardware programs were not implemented. The following is a general description of the test results:
Table 3 shows the voltage output value of LM94022 in "10" mode and the temperature value on PDF measured by a multimeter.

It can be seen from Table 3 that the displayed temperature is 0.46℃ lower than the temperature represented by the LM94022 output, so the linear formula is corrected:
Tem=Tem+0.46
Cause analysis: It may be related to the voltage drop of the current limiting resistor. Since the role of the current limiting resistor is indispensable and the output voltage fluctuation of the LM94022 is not large, a correction value is used to compensate for this voltage drop to achieve higher accuracy.
5.2 Functions realized by the system
(1) It can digitally display the measured temperature, and the measuring temperature range is 0~100℃;
(2) The resolution is not less than 0.5℃;
(3) The temperature measurement accuracy is improved, and the resolution is not less than 0.1℃;
(4) It has the function of timing and time display;
(5) There are at least two high and low temperature limit control output interfaces to control the external circuit. In actual production, the light-emitting diode can be used to simulate the display of its control state output;
(6) The high and low temperature limit control points can be set independently within the range of 0~100℃;
(7) When the temperature reaches the high and low temperature limit control points, an audible and visual alarm is issued;
(8) The temperature value is automatically measured in sequence;
(9) Multi-channel temperature inspection (at least two channels).
In addition, the temperature sensor can be moved by connecting the wires, which is convenient for measuring the temperature at different locations, and the multi-channel measurement can be moved effectively, which is convenient for operation when changing the measurement location.


6 Conclusion
The thermometer reported in this paper uses the high-resolution temperature measurement and control chip LM94022, uses the FM1602C liquid crystal display to realize temperature display, and uses the STC89C58 single-chip computer as the control center. The design and production of a wide-range, high-precision, multi-functional digital thermometer can accurately meet various requirements. Compared with traditional thermometers, this digital thermometer has the characteristics of convenient reading, wide temperature measurement range, accurate temperature measurement, and its output temperature and time are displayed digitally. It not only has high resolution, but also can set the upper and lower limits of the alarm temperature. When the temperature reaches the high and low temperature control points, an audible and visual alarm is issued, which is widely used in actual temperature control systems.

Reference address:Design and implementation of digital thermometer based on STC89C58

Previous article:dsPIC33FJ256MC710 Troubleshooting and Solutions
Next article:Design and implementation of binocular vision monitoring system based on DM642

Latest Industrial Control Articles
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号