#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar temp,aa,numdu,numwe;
uchar bai,shi,ge;
uint a=0,b=5;
sbit duan=P2^6;
sbit wei=P2^7;
uchar code tabledu[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
uchar code tablewe[]={
0xfe,0xfd,0xfb,0xf7,0xef,0xdf};
void in();
void display(uchar bai,uchar shi,uchar ge);
void main()
{
int temp=0;
in();
while(1)
{
if(a==20)
{
a=0;
if(temp==100)
{
temp=0;
}
bai=temp/100;
shi=temp/10%10;
ge=temp%10;
temp++;
display(bai,shi,ge);
}
}
}
void in()
{
EA=1;
ET0=1;
ET1=1;
TMOD=0x01;
TH0=(65536-10000)/256;
TL0=(65536-10000)%256;
TH1=(65536-1000)/256;
TL1=(65536-1000)%256;
TR0=1;
wei=0;
duan=0;
}
void display(uchar bai,uchar shi,uchar ge)
{
TR1=1;
while(1)
{
while(b);
b=5;
wei=1;
P0=tablewe[0];
wei=1;
duan=1;
P0=tabledu[bai];
duan=0;
while(b);
b=5;
wei=1;
P0=tablewe[1];
wei=1;
duan=1;
P0=tabledu[shi];
duan=0;
while(b);
b=5;
wei=1;
P0=tablewe[2];
wei=1;
duan=1;
P0=tabledu[ge];
duan=0;
}
}
void time0()interrupt 1
{
TH0=(65536-10000)/256;
TL0=(65536-10000)%256;
a++;
}
void time1()interrupt 3
{
TH1=(65536-1000)/256;
TL1=(65536-1000)%256;
b--;
}
#define uint unsigned int
#define uchar unsigned char
uchar temp,aa,numdu,numwe;
uchar bai,shi,ge;
uint a=0,b=5;
sbit duan=P2^6;
sbit wei=P2^7;
uchar code tabledu[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
uchar code tablewe[]={
0xfe,0xfd,0xfb,0xf7,0xef,0xdf};
void in();
void display(uchar bai,uchar shi,uchar ge);
void main()
{
int temp=0;
in();
while(1)
{
if(a==20)
{
a=0;
if(temp==100)
{
temp=0;
}
bai=temp/100;
shi=temp/10%10;
ge=temp%10;
temp++;
display(bai,shi,ge);
}
}
}
void in()
{
EA=1;
ET0=1;
ET1=1;
TMOD=0x01;
TH0=(65536-10000)/256;
TL0=(65536-10000)%256;
TH1=(65536-1000)/256;
TL1=(65536-1000)%256;
TR0=1;
wei=0;
duan=0;
}
void display(uchar bai,uchar shi,uchar ge)
{
TR1=1;
while(1)
{
while(b);
b=5;
wei=1;
P0=tablewe[0];
wei=1;
duan=1;
P0=tabledu[bai];
duan=0;
while(b);
b=5;
wei=1;
P0=tablewe[1];
wei=1;
duan=1;
P0=tabledu[shi];
duan=0;
while(b);
b=5;
wei=1;
P0=tablewe[2];
wei=1;
duan=1;
P0=tabledu[ge];
duan=0;
}
}
void time0()interrupt 1
{
TH0=(65536-10000)/256;
TL0=(65536-10000)%256;
a++;
}
void time1()interrupt 3
{
TH1=(65536-1000)/256;
TL1=(65536-1000)%256;
b--;
}