#include<reg51.h>
#include<display.h>
#define uchar unsigned char
uchar p=0;
uchar second[2];
void Init_
time0(void);
void main(void)
{
uchar i,s;
delayus(10);
Init_time0();
lcd_init();
s=60;
while(1)
{
second[0]=s/10;
second[1]=s%10;
lcd_pos(0,0);
for(i=0;i<2;i++)
{
lcd_wdat(second[i]+0x30);
}
lcd_wdat('s');
while(p==200);
p=0;
if(s)
s--;
}
}
void Init_time0(void)
{
TMOD|=0x01;
TH0=(65536-4068)/256;
TL0=(65536-4068)%256;
EA=1;
ET0=1;
TR0=1;
}
void time0()interrupt 1
{
TH0=(65536-4068)/256;
TL0=(65536-4068)%256;
p++;
}
一周热门 更多>