- 7
- 0
- 约6.67千字
- 约 12页
- 2018-05-30 发布于湖北
- 举报
C51实时时钟程序(三个)时钟一:#includereg52.h#includeintrins.h#define uchar unsigned char#define uint unsigned intuchar code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};uchar count=0,secL,secH,minL,minH,hourL,hourH;longint sum;void Delay(uint k){while(k0)k--;}void init_timer0(){TMOD = 0x01;TH0 = (65536-50000)/256;TL0 = (65536-50000)%256;EA = 1;ET0 = 1;TR0 = 1;}void timer0() interrupt 1 {TH0=(65536-50000)/256;TL0=(65536-50000)%256;count++;if(count==20){count = 0;sum++;}if(count20)count = 0;} void calculate(){hourH=sum/60/60%24/10;hourL=sum/60/60%24%10;minH=sum/60%60/10;minL=sum/60%60%10;sec
原创力文档

文档评论(0)