Design of 51 single chip microcomputer for temperature acquisition and control system

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

1 Introduction
Aiming at the shortcomings of the complex temperature measurement circuit composed of traditional temperature measuring elements (thermocouples, thermal resistors) and cumbersome software debugging, a temperature acquisition control system based on MSC-51 single-chip microcomputer and ADC0809 is designed. The system uses the spare I/O interface in the single-chip microcomputer to realize real-time temperature acquisition and control in an interrupt manner, making full use of the CPU resource space, simplifying the complex process of measuring circuits and program debugging, and facilitating the development and application of technicians in practice.
2 Hardware Circuit Design
2.1 System Composition
Figure 1 is a block diagram of the system hardware composition. The external sensor transmits the electrical signal corresponding to the temperature to the A/D converter for analog-to-digital conversion. After completion, the data is transmitted to the single-chip microcomputer. After the single-chip microcomputer processes the data, it sends the data to the decoder and finally displays it on the digital tube. When there is a keyboard input to control the temperature, the single-chip microcomputer compares the A/D conversion data obtained at this time with the control set temperature. If it is lower than the set temperature, the external device is heated and the LED monochrome light is on; otherwise, it is not heated and the LED monochrome light is off.


2.2 System module design
(1) The main control module uses the minimum system of the single-chip microcomputer MSC-51 as the main control device, and uses the minimum main control module of the MSC-51 single-chip microcomputer. Since the program control is simple, the internal space of the device is sufficient to store the program, and no external memory is required. P0 and P1 ports are selected as output interfaces, and P2 port is used as input interface.
(2) Temperature acquisition module The temperature acquisition module consists of an external sensor, an electric heater and an ADC0809 device. The measurement range of the sensor is 0℃~50℃. Under ideal conditions, the following relationship is established between the output value D of the A/D converter and the input voltage signal V

In the formula, Vmax is the "high reference voltage value" connected to the device Vref+ pin; Vmin is the "low reference voltage value" connected to the device Vref- pin. DMAx is the conversion value output by the interface when the input voltage is Vmax. Dmin is the conversion value output by the interface when the input voltage is Vmin.
(3) Temperature display module The temperature display module consists of 8279 device and digital tube. OUTA0~OUTA3, OUTB0~OUTB3 inside 8279 are connected to decoder 74LS138 to control the display of seven-segment digital tube.
(4) Temperature control module The temperature control module consists of keyboard, MSC-51 device, electric heater, A/D converter, etc. The input of keyboard value is also controlled by 8279 device through row and column scanning, and then through the internal value comparison of MSC-51, the electric heater controls the temperature, thereby achieving the purpose of heat preservation.


2.3 System Hardware Connection
The system uses MSC-51 microcontroller as the main control device for data processing and transmission. In the design, the pin P0.4 of 74LS273 is connected to the switch of the external electric heater to control the heating. At the same time, the LED monochrome light is connected to the pin P0.4 of 74LS273 to display the status of the external electric heater. The pin CS of the A/D converter ADC0809 is connected to the output end of the decoder numbered "8300H", the EOC signal is connected to the pin P1.7 of MSC-51, and IN1 is connected to the temperature sensor. The pin CS of the digital display control device 8279 is connected to the output end of the decoder numbered "8700H". Figure 2 shows the keyboard and digital tube display circuit, and Figure 3 shows the A/D conversion circuit.


3 Software Design
The software is written in the MSC-51 microcontroller assembly language. The interrupt of the internal timer of the microcontroller is used to implement the call of the interrupt program and the function of refreshing data every 5 seconds, which greatly saves CPU resources and improves work efficiency.
3.1 Main program flow
Before the main program starts, set pseudo instructions to facilitate the search of each device address and initialization command when writing the program. The interrupt program of timer 1 is set in the main program, which generates an interrupt at a fixed time and enters the interrupt subroutine. The main program entry address is 0000H, and the interrupt entry address is 001BH. In order to avoid conflicts between the storage location of the program and the preset storage location of the microcontroller, only jump instructions are placed in each entry address. The storage address of the main program starts from 0500H.
The main program starts with "START". After setting the stack bottom and the initialization program of each interface device. Start timer 1 to start timing. When the counting time is 50 ms, timer 1 generates an interrupt and enters the interrupt subroutine. The main program flow is shown in Figure 4.

The main program code is as follows:


3.2 System interrupt subroutine flow
Figure 5 is the interrupt subroutine flow, and its program steps are as follows: The single-chip microcomputer responds to the interrupt of timer 1, enters the interrupt subroutine "FRESH", sets the timing time of 50 ms, and after 100 cycles, obtains the refresh time of 5 s. When the 5 s timing is reached, it immediately enters the A/D converter to read data. Compare the value obtained by the A/D converter with the preset temperature value. If the measured value is lower than the preset temperature, the electric heater is started, and L=ED is on; otherwise, continue to the next step. The digital tube is initialized, and the hexadecimal value after A/D conversion is converted to a decimal value and displayed and output.

4 Conclusion
This solution has the characteristics of saving interface resources, high CPU utilization, fast execution speed, simplicity and ease of implementation, and has the value of promotion. However, due to the shortcomings of errors in the system itself and device conversion, the design needs to further improve the control accuracy and reduce the error, so as to improve the overall performance of the system.


Reference address:Design of 51 single chip microcomputer for temperature acquisition and control system

Previous article:Design of automatic line patrol wheel robot control system based on 51 single chip microcomputer
Next article:Optimization Design of Switching Power Supply Based on 89C51 Single Chip Microcomputer

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号