#include<reg51.h>
#define led P0
sbit x=P2^2;
sbit y=P2^3;
sbit z=P2^4;
void zhongduan();
char d1,d2,i;
unsigned char num;
char j=10;
char time;
unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
void main(){
time=21;
zhongduan();
while(1){
if(num==20){num=0;
d1=time/10;
d2=time%10;
time--;
while(1){
for(i=0;i<2;i++){
switch(i){
case(0):z=0;y=0;x=0;break;
case(1):z=0;y=0;x=1;break;
}
if(i==0){
led=table[d1];}
else{
led=table[d2];
}
j--;
led=0x00;}
}}
}
}
/////////////////////////////////////////////
void zhongduan(){
TMOD=0x01;
TH0=0x3C;
TL0=0xb0;
EA=1;
ET0=1;
TR0=1;
}
/////////////////////////////////////////////
void cut() interrupt 1{
TH0=0x3c;
TL0=0xb0;
num++;
}
#define led P0
sbit x=P2^2;
sbit y=P2^3;
sbit z=P2^4;
void zhongduan();
char d1,d2,i;
unsigned char num;
char j=10;
char time;
unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
void main(){
time=21;
zhongduan();
while(1){
if(num==20){num=0;
d1=time/10;
d2=time%10;
time--;
while(1){
for(i=0;i<2;i++){
switch(i){
case(0):z=0;y=0;x=0;break;
case(1):z=0;y=0;x=1;break;
}
if(i==0){
led=table[d1];}
else{
led=table[d2];
}
j--;
led=0x00;}
}}
}
}
/////////////////////////////////////////////
void zhongduan(){
TMOD=0x01;
TH0=0x3C;
TL0=0xb0;
EA=1;
ET0=1;
TR0=1;
}
/////////////////////////////////////////////
void cut() interrupt 1{
TH0=0x3c;
TL0=0xb0;
num++;
}