这儿和上面一篇数字秒表差不多,只不过杂乱在多了四个七段显现屏,整个显现分为时、分、秒三部分。时为24时置为0,分为60时置为0并向时进1,秒为60时置为0并向分进1。
#include
#include
void delay(unsigned char dly)
{
;
}
unsigned char num,time1,time2,time3;
void timer0()interrupt 1
{
}
}
void intial()
{
}
void main()
{
if(time1==60)
time2++;
if(time2==60)
shi=time1/10;
fen=time1% 10;
P2=0xf7;
P0=table[shi];
delay(2);
P2=0xfb;
P0=table[fen];
delay(2);
shi=time2/10;
fen=time2% 10;
P2=0xdf;
P0=table[shi];
delay(2);
P2=0xef;
P0=table[fen];
delay(2);
shi=time3/10;
fen=time3% 10;
P2=0x7f;
P0=table[shi];
delay(2);
P2=0xbf;
P0=table[fen];
delay(2);
}
}