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.
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
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
- Those wiring skills required for high-frequency circuit design
- 【Smart Network Desk Lamp】4. Using the onboard buttons of ESP32-S2
- CC2541 MLT-BT05 Bluetooth module and microcontroller serial communication data
- How big is the difference between non-contact capacitive liquid level sensors and touch switches
- STTS22H digital temperature sensor PCB package, driver
- Evaluation summary: Yatli AT-START-F425, the first choice for USB and CAN applications
- Automatic switching between solar water heater and electric water heater
- One picture to understand the chip series: Huawei Kirin super popular science - RF
- Research and development of supercapacitor urban public transportation electric vehicles
- [Raspberry Pi Pico Review] Serial communication function and its test