课题四__数码管显示.docVIP

  • 2
  • 0
  • 约1.28千字
  • 约 21页
  • 2019-12-23 发布于湖北
  • 举报
? ? ? ? ? ? ? ? ? ? ? ? ? ? void timer0( interrupt 1 //定时器函数 { TH0=(65536-50000/256; //50MS TL0=(65536-50000%256; //晶振:12M计算 count++; //50毫秒中断一次count便加1 if(count=20 //中断了20次?(20*50=1秒 {count=0;sec++;} //计数清零/秒加1 if(sec==60 //满了60秒? {sec=0;min++;} //秒清零/分加1 if(min==60 //满了60分钟? {min=0;hour++;} //分清零/时加1 if(hour==24 //满了24小时? {hour=0;} //时清零 } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? void display( //数码管显示子函数 { uchar s ; for(s=0;s=10;s++//扫描//控制显示刷新和按键速度 { P1=tab1[hour/10]; P0=tab2[7]; delay(2;//时十位 P1=tab1[hour%10]; P0=tab2[6]; delay(2;//时个位 P1=tab1[11]; P0=tab2[5]; delay(2;//横 P1=tab1[m

文档评论(0)

1亿VIP精品文档

相关文档