Design of digital thermometer based on AT89C2051

Publisher:WiseThinkerLatest update time:2010-11-19 Source: 现代电子技术 Keywords:DSB  ATC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Single-chip microcomputer control has become one of the goals pursued by electronic design today. This article applies this control technology to temperature measurement. AT89C2051 is a low-voltage, high-performance CMOS 8-bit single-chip microcomputer produced by Atmel Corporation of the United States. It contains 2 KB of repeatedly erasable read-only program memory and 128 B of random access data memory (RAM). The DSl-8B20 single-wire intelligent temperature sensor produced by DALLAS Semiconductor Corporation of the United States is a new generation of intelligent sensors adapted to microprocessors. The digital thermometer is a thermometer that uses DS18B20 as the detection element and AT89C2051 as the main controller. It has the characteristics of low power consumption, simple structure, convenient reading, wide temperature measurement range and accurate temperature measurement.

1 Circuit structure and working principle

1.1 Hardware Design

The thermometer composed of AT89C2051 mainly consists of three parts: DS18B20 temperature sensor, MCU AT89C2051, and display module composed of LED digital tube. Its system principle block diagram is shown in Figure 1. DS18B20, as the external signal source of MCU AT89C2051, converts the collected temperature into digital signal and transmits it to 2051 through I/O interface. 2051 starts the control program in ROM to drive LED digital tube, transmits data to digital tube through I/O interface and data line (interface between MCU and digital tube), and displays the collected temperature.


1.2 Overall circuit diagram

The temperature measurement system circuit diagram based on AT89C2051 converts the temperature into a signed digital signal (in the form of sixteen-bit complement, occupying two bytes). If a shielded twisted pair cable is used, the length of the connection can reach 150 m. The output pin I/0 is directly connected to P3.4 of the microcontroller. R1 is a pull-up resistor, and the sensor is powered by an external power supply. AT89C2051 is the core part of the entire system, containing 2 KB of FLASH ROM, where the user program is stored. The display module consists of a four-in-one common anode digital tube and four 9012s. The system program is divided into two parts: the sensor control program and the display program. The sensor control program is compiled according to the communication protocol of DS18B20. The system works under program control to complete the reading and writing of the sensor and the display of the temperature.

The main technical indicators of the product are: measurement range: -55~+125℃, measurement accuracy: 0.5℃; response time is less than or equal to 500 ms.

2 Software Design

2.1 Acquisition Module

This module uses a single-wire temperature sensor DS18B20 to complete temperature acquisition. The access process of the MCU AT89C51 to DS18B20 is as follows: first initialize DS18B20, then perform ROM operation commands, and finally operate the memory. Each operation of DS18B20 must follow strict working timing and communication protocols. According to the communication protocol of DS18B20, three steps are required: DS18B20 must be reset before each reading and writing. After the reset is successful, a ROM instruction (instruction code CCH) is sent and the flag is set. According to the flag, it is judged whether the initialization is successful. Finally, the RAM instruction (instruction code 44H) is sent to DS18B20 to start conversion, and then the temperature conversion value is read out (instruction code BEH). The high byte of the read temperature value is sent to the 27H unit, and the low byte is sent to the 26H unit. Then, according to the representation format of the temperature value byte and its sign bit, the actual temperature value can be obtained through simple transformation.


2.2 Main processing module

The main processing module mainly coordinates the various modules to realize data interaction. The main processing module first completes the initialization work, and then enters the loop processing. During the loop process, the data of the acquisition module is obtained, and the data is processed and displayed according to the processed results. The flowchart of the main processing is shown in Figure 3.


2.3 Display module

The dynamic scanning method is adopted, in which P3.0, P3.1, P3.2, and P3.3 control the bit selection, and P1 controls the segment selection. P3.0, P3.1, P3.2, and P3.3 output scanning signals to each bit in turn, so that only one digital tube is selected at each moment, and then P1 sends the font code to be displayed in the bit to light up the font displayed in the font segment of the bit. Under the coordinated control of the code segment sent by P1 and the bit segment sent by P3.0, P3.1, P3.2, and P3.3, each digital tube lights up in turn to display its own font.

3 Conclusion

The temperature sensor designed uses the improved intelligent temperature sensor DS18B20 with a temperature measurement range of -55 to +125°C and a maximum resolution of 0.0625°C. It can directly read the measured temperature value and is connected to the microcontroller using a single-wire system, reducing external hardware circuits. It can also directly convert the temperature into a serial digital signal for microcomputer processing.

Keywords:DSB  ATC Reference address:Design of digital thermometer based on AT89C2051

Previous article:Design of liquid dripping speed monitoring system based on 89C51
Next article:Design of single-chip computer experimental system based on C8051F and FPGA

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号