51单片机24小时闹钟时钟可调简单程序

上传人:宝路 文档编号:23426010 上传时间:2017-12-01 格式:DOC 页数:3 大小:38.56KB
返回 下载 相关 举报
51单片机24小时闹钟时钟可调简单程序_第1页
第1页 / 共3页
51单片机24小时闹钟时钟可调简单程序_第2页
第2页 / 共3页
51单片机24小时闹钟时钟可调简单程序_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

《51单片机24小时闹钟时钟可调简单程序》由会员分享,可在线阅读,更多相关《51单片机24小时闹钟时钟可调简单程序(3页珍藏版)》请在金锄头文库上搜索。

1、#include unsigned char seg10=0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90;unsigned char con6=0x1,0x2,0x4,0x8,0x10,0x20;unsigned char mm=0;unsigned char ss=0;unsigned char hh=0;unsigned char count=100;unsigned char TH=01,TM=00,m;sbit S1=P33;sbit S2=P34;sbit S3=P35;sbit S4=P36;sbit S5=P37;sbit S6

2、=P32;sbit bell=P30;main()TMOD=1;TH0=-100008;TL0=-10000; /10 毫秒间隔EA=1;ET0=1;TR0=1;while(1);void isr_time0() interrupt 1 /24 小时 unsigned int i=0,j;unsigned char time6;TH0=-100008;TL0=-10000;count-;if(count=0)count=100;ss+;if(ss=60)ss=0;mm+;if(mm=60)mm=0;hh+;if(hh=24)hh=0;if(S5=0)TH+; /闹钟调时if(S6=0)TM+; /闹钟调分if(hh=TH) unsigned int a,b,y;if(mm=01)m=0; if(mm=TM&ss0)hh-; /时钟减if(hh=0)hh=23;if(S4=0&mm0)mm-; /分钟减if(mm=0) mm=59;time3=hh/10;time2=hh%10; /显示位time1=mm/10;time0=mm%10;for(i=0;i0;j-);

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号