没有定义K么,应该是这样
#include <reg51.h>#define uchar unsigned char
#define uint unsigned int
uchar code
DSY_CODE[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
uchar Disp_Buffer[]={0,0,0,0,0};
uchar code DSY_BIT[]={0xFE,0xFD,0xFB,0xF7,0xEF};
uchar Count=0;
sbitK1=P1^0;
void Delay(uchar X)
{
uchar i;
while(X--)for(i=0;i<120;i++);
}
void main()
{
uchar i;
IE=0x8A;
TMOD=0X51;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
while(1)
{
if(K1==0)
{
Delay(10);
if(K1==0)
{
TR1=TR0=1;
}
}
else
{
for(i=0;i<5;i++)
{
P2=DSY_BIT[i];
P0=DSY_CODE[Disp_Buffer[i]];
Delay(2);
}
}
}
}
void INT_T0() interrupt 1
{
uint Tmp;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
if(++Count==200)
{
TR1=TR0=0;
Count=0;
Tmp=TH1*256+TL1;
Disp_Buffer[4]=Tmp*6/10000;
Disp_Buffer[3]=Tmp*6/1000%10;
Disp_Buffer[2]=Tmp*6/100%10;
Disp_Buffer[1]=Tmp*6%10;
TH1=TL1=0;
}
}