Curriculum design of single chip microcomputer, digital thermometer.

1.? Experimental mission?

The adjustable resistor is used to adjust the voltage value as the analog temperature input. When the temperature is lower than 30℃, a long buzzer alarm and an optical alarm will be given, and when the temperature is higher than 60℃, a short buzzer alarm and an optical alarm will be given. The measuring temperature range is 0-99℃.

2.? Schematic circuit diagram

(Figure) See the diagram.

3.? Hardware wiring on the system board?

a)? Connect P 1.0-P 1.7 in the area of "Single Chip Microcomputer System" with the ABCDEFGH port in the area of "Dynamic Digital Display" with an 8-core flat cable. ?

b)? Connect P2.0-P2.7 in the "Single Chip Microcomputer System" area and s 1s 2s 3s 5s 6s 7s 8 in the "Dynamic Digital Display" area with an 8-core cable. ?

c)? Connect P3.0 in the area of "single chip microcomputer system" with the ST terminal in the area of "analog-to-digital conversion module" with wires. ?

d)? Connect P3. 1 in the area of "single chip microcomputer system" with OE terminal in the area of "analog-to-digital conversion module" with wires. ?

e)? Connect P3.2 in the area of "single chip microcomputer system" with EOC terminal in the area of "analog-to-digital conversion module" with wires. ?

f)? Connect P3.3 in the area of "single chip microcomputer system" with the CLK terminal in the area of "analog-to-digital conversion module" with wires. ?

g)? Connect the terminal A2A 1A0 in the "A/D conversion module" area to the terminal GND in the "power module" area with wires. ?

h)? Connect the IN0 terminal in the area of "A/D conversion module" to the VR 1 terminal in the area of "Three-way adjustable voltage module" with wires. ?

Me)? Connect P0.0-P0.7 in the area of "Single Chip Microcomputer System" to terminal d0d 1 2d 3d 4d 6d 7 in the area of "Analog-to-Digital Conversion Module" with an 8-core cable. ?

j)? Connect P3.6 and P3.7 in the area of "single chip microcomputer system" to L 1 and L2 in the area of "eight-way LED indicator module" by wires respectively. ?

k)? Connect P3.5 in the area of "Single Chip Microcomputer System" to SPK in the area of "Audio Amplification Module" with wires. At the port. ?

l)? Put SPK in the "Audio Amplification Module" area? Insert the audio speaker outward. ?

4.c language source program

# Contains? & ltAT89X52。 H & gt

Not signed? Charles? Code? dispbitcode[]={0xfe,0xfd,0xfb,0xf7,

0xef,0xdf,0xbf,0x7f };

Not signed? Charles? Code? dispcode[]={0x3f,0x06,0x5b,0x4f,0x66,

0x6d、0x7d、0x07、0x7f、0x6f、0x 00 };

Not signed? Charles? dispbuf[8]={ 10, 10, 10, 10, 10, 10,0,0 };

Not signed? Charles? dispcount

Not signed? Charles? getdata

Not signed? int? Temperature;

Not signed? Charles? Me;

sbit? st=p3^0;

sbit? oe=p3^ 1;

sbit? eoc=p3^2;

sbit? clk=p3^3;

sbit? led 1=p3^6;

sbit? led2=p3^7;

sbit? spk=p3^5;

Bit? lowflag

Bit? highflag

Not signed? int? cnta

Not signed? int? cntb

Bit? alarmflag

Invalid? Major (invalid)

{

ST = 0;

OE = 0;

TMOD = 0x 12;

TH0 = 0x 2 16;

TL0 = 0x 2 16;

th 1 =(65536-500)/256;

TL 1 =(65536-500)% 256;

tr 1 = 1;

TR0 = 1;

ET0 = 1;

et 1 = 1;

EA = 1;

ST = 1;

ST = 0;

while( 1)

{

if((lowflag== 1)? & amp& amp(highflag==0))

{

led 1 = 0;

led 2 = 1;

}

Or what? if((highflag== 1)? & amp& amp? (lowflag==0))

{

led 1 = 1;

led 2 = 0;

}

other

{

led 1 = 1;

led 2 = 1;

}

}

}

Invalid? t0(void)? Interrupt? 1? Use? 0

{

CLK = ~ CLK;

}

Invalid? t 1(void)? Interrupt? 3? Use? 0

{

th 1 =(65536-500)/256;

TL 1 =(65536-500)% 256;

if(EOC== 1)

{

OE = 1;

getdata = P0

OE = 0;

temp = getdata * 25

temp = temp/64;

I = 6;

disp buf[0]= 10;

disp buf[ 1]= 10;

disp buf[2]= 10;

disp buf[3]= 10;

disp buf[4]= 10;

disp buf[5]= 10;

disp buf[6]= 0;

disp buf[7]= 0;

while(temp/ 10)

{

disp buf[I]= temp % 10;

temp = temp/ 10;

i++;

}

disp buf[I]= temp;

if(get data & lt; 77)

{

low flag = 1;

high flag = 0;

}

Or what? if(get data & gt; 153)

{

low flag = 0;

high flag = 1;

}

other

{

low flag = 0;

high flag = 0;

}

ST = 1;

ST = 0;

}

p 1 = disp code[disp buf[disp count]];

P2 = dispbitcode[disp count];

disp count++;

if(dispcount==8)

{

dispcount = 0;

}

if((lowflag== 1)? & amp& amp? (highflag==0))

{

cnta++;

If (cnta==800)

{

cnta = 0;

alarmflag = ~ alarmflag

}

if(alarmflag== 1)

{

SPK = ~ SPK;

}

}

Or what? if((lowflag==0)? & amp& amp? (highflag== 1))

{

CNT b++;

If (cntb==400)

{

cntb = 0;

alarmflag = ~ alarmflag

}

if(alarmflag== 1)

{

SPK = ~ SPK;

}

}

other

{

alarm flag = 0;

cnta = 0;

cntb = 0;

}

}