The realization of furnace temperature control c language, the temperature control system design based on C8051F single chip microcomputer includes schematic diagram + C language source code...

1. The design task of this design experiment consists of five modules, namely the production of the single-chip microcomputer system, the design and production of the digital tube display module, the design and production of the keyboard circuit, the production of the analog-to-digital conversion circuit, and the digital-to-analog conversion circuit. After completing the debugging of each individual module, it is necessary to write the entire system program and the joint debugging work between each module. For the whole system, a sub-module design and testing process is carried out to reduce the possibility of errors during joint debugging.

2.1 Overview of MCU module

First of all, what we make is the most important part of the whole system - the single-chip module. The one-chip computer of this system chooses the 51 series one-chip computer that is most widely used at present. In order to make the one-chip computer can complete more complex work, it is necessary to expand the pin function of the one-chip computer. In order to realize the function of the system, a data/address separation circuit and an address decoding circuit are configured in the single-chip microcomputer module. Specifically, 74LS373 is used in the single-chip microcomputer module to latch the address data, and 74LS138 is used as part of the address decoding circuit. Then use the JTAG adapter to download the program written in the computer to the single-chip microcomputer, and use the oscilloscope to detect the output signal of the single-chip microcomputer.

2.2 MCU module design circuit diagram #include "C8051F020.h"

#include "absacc.h"

#include "data_define.c "

#include " Init_Device.c "

#define    CS0  XBYTE[0x0005]

#define    CS1  XBYTE[0x200A]

#define    CS2  XBYTE[0x4005]

#define    CS3  XBYTE[0x600A]

#define    CS4  XBYTE[0x8005]

#define    CS5  XBYTE[0xA00A]

void main(void)

{

uchar a;

Init_Device();

while(1)

{

CS0=0x55;

a = CS1;

CS2=0xaa;

a=CS3;

CS4=0x55;

a = CS5;

}

} Copy code

3.1 Overview of digital tube display circuit module

We mainly carried out the design and manufacture of display circuit. For the entire display module, the measured temperature and the target temperature input from the keyboard are displayed mainly through four 7-segment digital tubes. In addition, in the digital tube display module, four 74LS273 are also used to latch the output data of the single-chip microcomputer, so that the content displayed on the remaining digital tubes can be preserved when the single-chip microcomputer can transmit data to the digital tube in turn. In addition, the 74LS138 decoder is used to select the digital tube that needs to transmit data.

3.2 Digital tube display circuit module design circuit diagram #include "C8051F020.h"

#include "absacc.h"

#include "data_define.c"

#define    LED1      XBYTE[0x0002]        //0010

#define    LED2      XBYTE[0x0003]        //0011

#define    LED3      XBYTE[0x0008]        //1000

#define    LED4      XBYTE[0x0009]        //1001

#define    TIMER    0x8000

#include "Init_Device.c"

unsigned char table[  ]={0xC0,0xF9,0xA4,0xB0,0x99,

0x92,0x82,0xF8,0x80,0x90};

void delay(void)

{

unsigned int i;

for(i=0;i

}

void main(void)

{

unsigned  char i;

Init_Device();

LED1=LED2=0xff;

while(1)

{

for(i=0;i<10;++i)

{

LED1=table[i];

LED2=table[i];

LED3=table[i];

LED4=table[i];

delay( );

delay( );

delay( );

delay( );

delay( );

}

}

} Copy code

4. Keyboard module

4.1 Overview of keyboard module

As in this engineering design, an off-the-shelf keyboard module has been provided. Therefore, it is only necessary to design and manufacture the reading circuit corresponding to the keyboard module. In this experiment, we chose the address scan mode. The feature of this mode is that the 74LS138 chip outputs a low level to the first to fourth rows of the keyboard in turn, and reads the level of each column in the next process, and then determines which row and which column of keys are pressed. A 74LS244 is used in this module, which is a 3-state 8-bit buffer chip, which is used as a driving signal chip. Usually the output current of the I/O port of the microcontroller is very small, and the 74LS244 is used to amplify the current. It should be noted that the 74LS244 is unidirectional, so do not reverse it during the connection process.

4.2 Circuit diagram of keyboard reading module #include "C8051F020.h"

#include "absacc.h"

#include "data_define.c"

#define   DP1   XBYTE[0x0002]

#define   DP2   XBYTE[0x0003]

#define   DP3   XBYTE[0x0008]

#define   DP4   XBYTE[0x0009]

#define   TIMER 0x8000

#include "Init_Device.c"

unsigned char table[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};

void display(unsigned char x,unsigned char y)

{

DP3=table[x];

DP4=table[y];

DP1=table[x];

DP2=table[y];

}

void main(void)

{

unsigned  char l_val,r_val,r_state,temp,conter,x,c;

int key;

DP1=DP2=DP3=DP4=0xff;

Init_Device();

while(1)

{

key=0x0004;

for(x=1;x<5;x++,key++)

{

c=XBYTE[key];

if(r_state=~c&0x1f)

{

for(conter=1,temp=0x01;conter<6;++conter,temp=temp<<1)

if((r_state&temp)!=0)

{

r_val=contain;

l_val=x;

display(l_val,r_val);

}

}

}

}

} Copy code

For this program, when a certain key in the keyboard is pressed, the value of the row and column of the pressed key will be displayed on the nixie tube in turn, so that it can be judged whether the keyboard key value reading module is working normally.

5. Analog-to-digital conversion circuit

5.1 Overview of analog-to-digital conversion circuit

For the analog-to-digital conversion circuit, ADC0804 successive approximation A/D conversion chip is selected in this experiment, which can meet the requirements of converting the input 0~+5V analog signal into 8-bit digital quantity. The relationship between the conversion result and the analog input voltage is determined by the relationship.

5.2 Analog-to-digital conversion circuit design circuit diagram

Figure 5-1 Design circuit diagram of analog-to-digital conversion circuit

#include "C8051F020.h"

#include "absacc.h"

#include "data_define.c"

#define   CS1      XBYTE[0x2000]

#define   TIMER   0x8000

#include "Init_Device.c"

void delay(void);

void main(void)

{

unsigned char x;

Init_Device();

while(1) { CS1=x; delay(); x=CS1; delay(); }

}

void delay(void)

{

unsigned int i;

for(i=0;i

} Copy code

For this program, during the debugging process, the value of the variable x is added to the observation window, and the value of the output voltage analog of the test bench is constantly changed to check whether the value of the variable x is consistent with its result. (0V approximately corresponds to the digital quantity 0, and +5V approximately corresponds to the digital quantity 255) It should be noted that the variable resistance of the transmitter should be adjusted to an appropriate resistance value before the digital-to-analog conversion.

5. Digital-to-analog conversion module

6.1 Overview of digital-to-analog conversion module

In the digital-to-analog conversion module, a DAC0832 and an operational amplifier cascaded by two LM358s are used to realize a conversion of the input digital quantity from 0 to 100 degrees Celsius and the analog quantity of -10V to +10V, and then to the subsequent semiconductors. Refrigerator control.

Related Posts