Home > other >  ADC0808 temperature control program has not defined? Please give advice or comments
ADC0808 temperature control program has not defined? Please give advice or comments

Time:10-14

#include
# define uchar unsigned char
# define uint unsigned int
Uchar code DSY_CODE []={x5b x3f 0, 0 x06, 0, 0 x4f, 0 x66, 0 x6d, 0 x7d, 0 x07, 0 x7f, 0 x6f};
Sbit ST=P2 ^ 5;
Sbit OE=P2 ^ 7;
Sbit EOC=P2 ^ 6;
Sbit CLK=P2 ^ 4;
Sbit H_LED=P3 ^ 0;
Sbit L_LED=P3 ^ 1;
Sbit BEEP=P3 ^ 7;
Uchar t=0;
Void DelayMS (uint x)
{
Uchar I;
While (x -)
For (I=0; I & lt; 120; I + +);
}
Void Show_Temperature ()
{
Uchar I, DSY_IDX []={XFD xf7 0, 0 XFB, 0};
For (I=0; i<3; I++)
{
P0=DSY_CODE [Temperature] [I];
The P2 & amp;=DSY_IDX [I];
DelayMS (5);
The P2 |=0 x0f;
}
}
Void main ()
{
Uchar d;
IE=0 x8a;
TMOD=18;
TH0=245;
TL0=0;
TH1=(65536-1000)/256;
TL1=(65536-1000) % 256;
TR0=1;
H_LED=L_LED=1;
While (1)
{
ST=0; ST=1; ST=0;
While (1)
{
If (EOC==1)
{
OE=1;
D=p;
OE=0;
Temperature [2]=d/100;
Temperature [1]=d % 100/10;
Temperature [0]=d % 10;
Show_Temperature ();
If (d<60)
{
TR1=1; L_LED=! H_LED;
}
The else
If (d> 160)
{
TR1=1; H_LED=! L_LED;
}
The else
{
TR1=0; H_LED=L_LED=1;
}
break;
}
}
}
}
Void T0_INT () interrupt 1
{
CLK=~ CLK;
}

Void T1_INT () interrupt 3
{
TH1=(65536-1000)/256;
TL1=(65536-1000) % 256;
BEEP=~ BEEP;
If (L_LED==0)
{
If (+ + t!=150) return;
}
The else
{
If (+ + t!=60) return;
}
T=0;
DelayMS (20);
}

CodePudding user response:

Since a variable is not defined, that you define isn't over!
  • Related