/*60秒循环*/
#include<reg51.h>
#define uchar unsigned char
#define uint unsigned int
uchar num,num1,shi,ge;
uchar code table[ ]={
0x02/*0*/,0x9f/*1*/,0x24/*2*/,
0x0c/*3*/,0x98/*4*/,0x48/*5*/,
0xc0/*6*/,0x1e/*7*/,0x00/*8*/
};/*共阳数码管0 8编码*/
delay(uint x)
{
uint i,j;
for(i=x;i>0;i--)
for(j=125;j>0;j--);
}
void display(uchar shi,uchar ge)
{
P3=0XFE;
P0=table[ge];
delay(10);
P3=0XFd;
P0=table[shi];
delay(10);
}
void main()
{
TMOD=0X01;
TH1=(65535-5000)/ 256;
TL0=(65535-5000)%256;
EA=1;
ET0=1;
TR0=1;
while(1)
{
void display(uchar shi,uchar ge);
}
}
void
time1() interrupt 1
{
TH1=(65535-5000)/ 256;
TL0=(65535-5000)%256;
if(num++==20)
{ num=0;
num1++;
if(num1==60)
num1=0;
shi=num1/10;
ge=num1%10;
}
}
{
void display(uchar shi,uchar ge);
}
很明显的错误
一周热门 更多>