Design of digital thermometer based on AT89C51&DS18820

Publisher:shmilydeLatest update time:2011-06-23 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1 Introduction
With the rapid development of modern information technology and the gradual realization of traditional industrial transformation, temperature detection and display systems that can work independently are applied in many fields. Traditional temperature detection uses thermistors as temperature sensitive elements. Thermistors have low cost, but require subsequent signal processing circuits, and their reliability is relatively poor, the temperature measurement accuracy is low, and the detection system also has certain errors. Compared with traditional thermometers, the digital thermometer designed here has the characteristics of convenient reading, wide temperature measurement range, accurate temperature measurement, digital display, and wide application range. The AT89C51 microcontroller is selected as the main control device, and the DSl8820 is used as the temperature sensor to transmit data through the 4-bit common anode LED digital tube serial port to realize temperature display. The measured temperature value is directly read by DSl8820 for data conversion. The physical and chemical properties of the device are stable, the linearity is good, and the maximum linear deviation is less than 0.1℃ at 0℃~100℃. The device can directly transmit digital signals to the microcontroller, which is convenient for microcontroller processing and control. In addition, the thermometer can also directly use the temperature measuring device to measure the temperature, thereby simplifying the data transmission and processing process.

2 System Hardware Design Scheme
According to the system functional requirements, the system principle structure block diagram shown in Figure 1 is constructed.

2.1 Selection of microcontroller
AT89C51 is the core device of the temperature test system design. This device is the basic product of the MCS-51 series of microcontrollers produced by INTEL. It adopts reliable CMOS process manufacturing technology and has high-performance 8-bit microcontrollers. It belongs to the standard MCS-51 CMOS product. It not only combines the high-speed and high-density technology of HMOS and the low-power characteristics of CHMOS, but also inherits and expands the architecture and instruction system of MCS-48 microcontrollers.
2.2 Connection between temperature sensor and microcontroller
The single bus (1-Wire) of the temperature sensor is connected to P2.0 of the microcontroller. P2.0 is the high-order address line A8 of the microcontroller. The P2 port is an 8-bit bidirectional I/O with an internal pull-up resistor. Its output buffer stage can drive (absorb or output current) 4 TTL logic gate circuits. Writing "1" to this port can pull its port to a high level through the internal pull-up resistor. At this time, it can be used as an input port. This is because there is an internal pull-up resistor. When a pin is pulled low by an external signal, a current will be output. When accessing external program memory or external data memory with 16-bit address. If the MOVX DPTR instruction is executed, it means that the P2 port sends out the high 8-bit address data. When accessing the external data memory with 8-bit address, the MOVX RI instruction can be executed. The content of the P2 port is the content of the R2 register in the special function register (SFR) area, which does not change during the entire access period. During Flash programming and program verification, the P2 port also receives high-order addresses and other control signals. Figure 2 shows the internal structure of DS18820. Figure 3 shows the interface circuit between DS18820 and the microcontroller.

2.3 Reset signal and external reset
circuit The P1.6 port of the microcontroller is the input end of the dog feeding signal in the MAX813 watchdog circuit, that is, the microcontroller sets a dog feeding signal every time it executes a program to clear the watchdog device. If the program is abnormal, the microcontroller pin RST will appear high for more than two machine cycles to reset it. The reset signal is valid at a high level, and its validity time should last for 24 oscillation pulse cycles, that is, more than two machine cycles. If a crystal oscillator with a frequency of 12 MHz is used, the reset signal duration should exceed 2μs to complete the reset operation.
2.4 Microcontroller and alarm circuit
The alarm circuit in the system is composed of a light-emitting diode and a current-limiting resistor, and is connected to the P1.2 port of the microcontroller. The function and connection method of the P1 port are the same as those of the P2 port, except that during Flash programming and program verification, P1 receives the lower 8-bit address data.
2.5 Power supply circuit
Since the system requires a stable 5 V power supply, a power supply that can meet the voltage, current and stability requirements must be used during design. The power supply uses the three-terminal integrated voltage regulator LM7805. It has only three pins: input, output and common. It has overcurrent protection, overheat protection and regulator tube safety protection circuits. Since it requires few external components, it is easy to use and reliable, so it can be used as a voltage-stabilized power supply. Figure 4 is the power supply circuit connection diagram.

2.6 Display circuit The
mature 74HCl64 is used to realize serial-to-parallel conversion. LED display is divided into static display and dynamic display. Static display is used here, and the system realizes static display through the serial port of the microcontroller. The serial port is in mode zero state, that is, it works in shift register mode, and the baud rate is 1/12 of the oscillation frequency. When the device executes any command with SBUF as the destination register, data starts to be sent from the RXD terminal. When the write signal is valid, the send control terminal SEND is valid after one machine cycle, that is, RXD is allowed to send data, and the shift pulse is allowed to be output from the TXD terminal. Figure 5 is the connection diagram of the display circuit.

2.7 Watchdog circuit
In the system, P1.6 is used as the "feeding" signal of the watchdog; the RESET of MAX813 is connected to the reset signal RST of the microcontroller. Since the microcontroller will give the watchdog device a reset signal every time it executes a program, it can also be reset manually. When the button is pressed, SW-SPST will generate a low level of more than 200 ms at the MAX813 pin. In fact, the watchdog device is not reset within 1.6 s, so the function of outputting a reset signal on pin 7 is the same. The connection diagram is shown in Figure 6.

3 Software Design
The main data elements of DS18820 are: 64-bit laser ROM, temperature sensitive elements and non-volatile temperature alarm triggers TH and TL. DSBl820 can obtain power from a single bus. When the signal line is at a high level, the energy is stored in the internal capacitor; when the single signal line is at a low level, the power supply is disconnected until the signal line becomes high and the parasitic (capacitive) power supply is reconnected. In addition, an external 5 V power supply can be connected to power the DS18820. The power supply mode of DS18820 is flexible, and the use of an external power supply can also increase the stability and reliability of the system. Figure 7 is a flowchart for reading data.

Part of the program code for reading DS18B20 data is:

4 Data test
Put the temperature sensor in contact with the ice-water mixture, stir it thoroughly to reach thermal equilibrium, and then adjust the system so that the display reading is 0.00 (calibrated to 0℃); use the barometer to read the local atmospheric pressure at that time, and calculate the actual pressure at that time based on the atmospheric pressure and the local gravity acceleration; find out the boiling point temperature based on the relationship between boiling point and pressure. Put the temperature sensor into boiling water, and readjust it after the display reading stabilizes. The work is completed when the display reading is equal to the local boiling point temperature at that time. The range of the thermometer is 50℃~150℃, and the reading accuracy is 0.1℃. The actual use is generally 0℃~100℃. The precision mercury thermometers of 0℃~50℃ and 50℃~100℃ are used as inspection standards to test the designed thermometer, and the results show that it can meet the accuracy requirements.

5 Conclusion
This temperature test system not only has the characteristics of simple structure, small size, low price, high accuracy, fast response speed, digital display and not easy to damage, but also has stable performance and a wide range of applications. Therefore, it is particularly suitable for places where accurate temperature measurement is required.

Reference address:Design of digital thermometer based on AT89C51&DS18820

Previous article:Hardware Design of Hybrid Suspension Control System Based on DSP
Next article:Design of digital thermometer based on AT89C51&DS18820

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号