89C52單片機之數(shù)字時鐘制作
#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);
}
}
評論