#include <regx52.h>
#define uchar unsigned char
#define uint unsigned int
uchar led[10]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90}
uchar M; ----------就是这里
uchar k;
uchar H;
uchar S;
void timer1 () interrupt 3
{k++;
if(k==3700)//这也不同的//
{k=0;
S++;
if (S==60)
{S=0;
M++;
if (M==60)
{M=0;
H++;
if (H==24)
H=0;
}
}
}
}
void delay(uchar i)
{
uchar j;
for(;i>0;i--)
for(j=255;j>0;j--)
;
}
int ABC(a,b,c)
{
P0=led[a%10];
P2=0xDF;
delay(10);
P0=led[a/10];
P2=0xEF;
delay(10);
P0=led[b%10];
P2=0xF7;
delay(10);
P0=led[b/10];
P2=0xFB;
delay(10);
P0=led[c%10];
P2=0xFD;
delay(10);
P0=led[c/10];
P2=0xFE;
delay(10);
}
main()
{ k=0;
S=0;
M=33;
H=21;
ET1=1;
TMOD=0x20;
TL1=6;
TH1=6;
TR1=1;
EA=1;
do {ABC(S,M,H);}
while(1);
}
记得我都成功运行过,后来编译老是抱错----第五行error C141: syntax error near 'unsigned'其他应该都没问题,我吧五六行交换,还是报第五行这个错