#include<reg52.h>sbit
a= P2^2;sbit b=P2^3;sbit c=P2^4; unsigned char code ledchar[]={0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F} ;
unsigned char ledbuff[8]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} ;
void main(){unsigned int cnt=0;unsigned long sec=0;unsigned char i=0;
TMOD=0x01;
TH0=0XFC;
TL0=0x67;
TR0=1;
while(1)
if(TF0==1)
{ TF0=0;
TH0=0xFC;
TL0=0x67;
cnt++;
if(cnt>=1000)
{
cnt=0;
sec++; ledbuff[0]=ledchar[sec%10] ; ledbuff[1]=ledchar[sec/10%10] ; ledbuff[2]=ledchar[sec/100%10] ; ledbuff[3]=ledchar[sec/1000%10] ; ledbuff[4]=ledchar[sec/1000%10] ; ledbuff[5]=ledchar[sec/10000%10] ; ledbuff[6]=ledchar[sec/100000%10] ; ledbuff[7]=ledchar[sec/1000000%10] ; }
if(i==0) { a=0;b=0;c=0 ;i++;P0=ledbuff[0];}
else if (i==1) {a=0;b=0;c=1;i++;P0=ledbuff[1];} else if (i==2) {a=0;b=1;c=0;i++;P0=ledbuff[2];} else if (i==3) {a=0;b=1;c=1;i++;P0=ledbuff[3];} else if (i==4) {a=1;b=0;c=0;i++;P0=ledbuff[4];} els |