Microcontroller temperature control system thesis Who told me how to write the introduction and abstract, to the Chinese and English version. And also summarize and thank you, who sends a to even ah #

Microcontroller temperature control system thesis Who told me how to write the introduction and abstract, to the Chinese and English version. And also summarize and thank you, who sends a to even ah #53 Temperature Measurement System Based on 51 Microcontroller

Abstract: Microcontroller is widely used in detection and control system, and temperature is one of the quantities that often need to be measured, controlled and maintained in the system. This paper introduces the design of temperature control system for AT89C2051 microcontroller from both hardware and software aspects, and gives a concise description of the hardware schematic and program block diagram.

Keywords: Microcontroller AT89C2051; Temperature Sensor DS18B20; Temperature; Measurement

Introduction

The application of microcontrollers in electronic products has become more and more widespread, and in many electronic products will also be used for temperature detection and temperature control. For this reason in this paper the authors have designed a temperature measurement system based on the AT89C2051 from atmel. This is a low-cost use of microcontroller redundant I / O port to achieve the temperature detection circuit, the circuit is very simple, easy to implement, and is suitable for almost all types of microcontrollers.

I. System hardware design

The hardware structure of the system is shown in Figure 1.

1.1 Data Acquisition

The data acquisition circuit is shown in Fig. 2, where the real-time temperature of the controlled object is collected by the temperature sensor DS18B20, and provided to the P3.2 port of AT89C2051 as the data input. In this design we control the object for the room temperature. Of course, as an improvement we can separate the sensor from the board, connected by the data line for communication, easy to measure a variety of objects.

DS18B20 is the DALLAS company produced a line of digital temperature sensors, with a 3-pin TO-92 small volume package form; temperature measurement range of -55 ℃ ~ +125 ℃, can be programmed for 9-bit ~ 12-bit A/D conversion accuracy, temperature resolution of up to 0.0625 ℃, the temperature being measured by the symbol of the 16-bit expansion. Measured temperature with symbols to expand the 16-bit digital serial output, support for 3V ~ 5.5V voltage range, so that the system design is more flexible and convenient; its power supply can be introduced at the remote end, but also can be generated using parasitic power supply; multiple DS18B20 can be connected in parallel to the 3 or 2 wires, the CPU only needs a port line can be a number of DS18B20 communication, taking up microprocessor ports less, saving a lot of time and money. Fewer ports can save a lot of leads and logic circuits. The above features make DS18B20 very suitable for remote multi-point temperature detection system. Resolution settings, and user-set alarm temperatures are stored in EEPROM, and are still saved after power down.DS18B20 makes more choices of voltage and characteristics, so that we can build an economical temperature measurement system that suits our needs. As shown in Figure 2 DS18B20 2 feet DQ for the digital signal input / output; 1 foot GND for the power supply ground; 3 feet VDD for the external power supply power input.

AT89C2051 (hereinafter referred to as 2051) is an 8051-compatible microcontroller microcontroller, and Intel's MCS-51 is fully compatible with the built-in 2K programmable Flash memory, there are 128B bytes of internal data memory space, you can directly drive the LEDs, and the 8051 is identical to the 15 programmable I / O points, respectively. P1 port and P3 port (less P3.6) respectively.

1.2 Interface Circuit

Figure 2 Connection diagram between MCU 2051 and temperature sensor DS18B20

The interface circuit consists of ATMEL's 2051 microcontroller, ULN2003 Darlington chip, 4511BCD decoder, Serial EEPROM24C16 (to save system parameters), MAX232, Digital tube and peripheral circuitry, the microcontroller to parallel communication from P1.0 ~ P1.7 port output control signals, through the 4511BCD decoder decoding, with two *** cathode LED static display of the temperature of the ten digits, a bit.

Serial EEPROM24C16 is a standard I2C specification and as long as two pins can be read and written. Since the P1 of the MCU 2051 is a bidirectional I/O port, we use the P1 port as an output port in our design. As can be seen in Figure 2, P1.7 is connected to pin 6 of the 24C16 as a serial clock output signal, and P1.6 is connected to pin 5 of the 24C16 as a serial data output. P1.4 and P1.5 are used as the bit selection signals for the two digital tubes to control, and when P1.4=1, the first digital tube (digit) is selected; and when P1.5=1, the second digital tube (ten digits) is selected. The output signals of P1.0 to P1.3 are connected to decoder 4511 as the display of digital tube. In addition, since the P3 port of MCU 2051 has special functions, P3.0 (RXD) serial input port, P3.1 (TXD) serial output port, P3.2 (INTO) external interrupt 0, P3.3 (INT1) external interrupt 1P3.4, (T0) external timing/counting input point, P3.5 (T1) external timing/counting input point. As can be seen from Figure 2, P3.0 and P3.1 serve as interfaces for serial communication with MAX232; P3.2 and P3.3 serve as interfaces for interrupt signals; P3.4 and P3.5 serve as external timing/counting input points. p3.7 serves as a pulse output to control the light-emitting diode's brightness.

Because of the *** cathode LED digital tube used in the circuit, so in the design of the circuit added a Darlington circuit ULN2003 to amplify the signal to generate a large enough current to drive the digital tube display. Because the 4511 can only BCD decimal decoding, can only be translated to 0 to 9, so here we use the 4511 decoding output we need the temperature.

1.3 Alarm Circuit Introduction

Figure 3 Temperature display on the seven-segment digital tube connection diagram

The alarm circuit designed in this paper is relatively simple, consists of a self-oscillating buzzer (as long as more than 3V voltage is added to both ends of the buzzer, the buzzer will be screaming) and a light-emitting diode (as shown in Figure 3). In this design the buzzer is controlled by the ULN2003 current amplifier IC. When the temperature we require reaches a certain upper or lower bound (in the text we set the upper bound temperature is 45 ℃, the lower bound temperature is 5 ℃), the alarm circuit begins to work, the main program design is as follows:

main()//main function

{unsigned char i=0; <br/>unsigned int m,n; <br/>while(1) <br/>{i=ReadTemperature();//read the temperature}

if(i>0 && i<=10) //If the temperature is between 0 and 10 degrees directly to the seven-segment digital tube assigns a value

{P1 =designP1[i];}

else///If the temperature is greater than 10 degrees

{m=i%10;//first assign value to the first seven-segment digital pipe <br/>D1=1; <br/>D2=0; <br/>P1=designP1[m]; <br/ <br/>n=i/10;//then assign a value to the second seven-segment digital tube <br/>D1=0; <br/>D2=1; <br/>P1=designP1[n]; <br/>if(n>=4&&m>=5)%%(m<. =5)//Judge the range of values of the temperature, if it is greater than 45 or less than 5 degrees, then the buzzer calls and the light-emitting diode blinks <br/>{ int a,b; <br/>Q1=1;//Buzzer calls <br/>for(a=0;a<1000;a++)//Light-emitting diode blinks <br/ >for(b=0;b<1000;b++) <br/>Q2=1; <br/>for(a=0;a<1000;a++) <br/>for(b=0;b<1000;b++) <br/>Q2=0;}}}