#defineuintunsignedchar#defineucharunsignedchar#defineTHCO0xee#defineTLCO0x0uchari,n"> #defineuintunsignedchar#defineucharunsignedchar#defineTHCO0xee#defineTLCO0x0uchari,n" />
电子闹钟(沈).doc

电子闹钟(沈).doc

ID:28733297

大小:28.00 KB

页数:8页

时间:2018-12-13

电子闹钟(沈).doc_第1页
电子闹钟(沈).doc_第2页
电子闹钟(沈).doc_第3页
电子闹钟(沈).doc_第4页
电子闹钟(沈).doc_第5页
资源描述:

《电子闹钟(沈).doc》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库

1、#include"reg51.h"#include#defineuintunsignedchar#defineucharunsignedchar#defineTHCO0xee#defineTLCO0x0uchari,n;uintH,L;voiddelay(uint);ucharcodetable[]={0xfd,0x09,0x04,0xfd,0x09,0x04,0xfd,0x34,0x04,0xfd,0x83,0x04,0xfd,0x83,0x04,0xfd,0x34,0x04,0xfd,0x09,0x04,0xfc,0xad,0x04,0xfc,0

2、x44,0x04,0xfc,0x44,0x04,0xfc,0xad,0x04,0xfd,0x09,0x04,0xfd,0x09,0x04,0xfc,0xad,0x04,0xfc,0xad,0x08,0xfd,0x09,0x04,0xfd,0x09,0x04,0xfd,0x34,0x04,0xfd,0x83,0x04,0xfd,0x83,0x04,0xfd,0x34,0x04,0xfd,0x09,0x04,0xfc,0xad,0x04,0xfc,0x44,0x04,0xfc,0x44,0x04,0xfc,0xad,0x04,0xfd,0x09,0x04,0xfc,0xad,

3、0x04,0xfc,0x44,0x04,0xfc,0x44,0x08};unsignedcharcodeDuan[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};//共阴极数码管,0-9段码表unsignedcharData_Buffer[10]={0,1,2,3,4,5,6,7,8,9};//四个数码管显示数值,数组变量定义staticunsignedcharBit=0;//静态变量,退出程序后,值保留staticunsignedcharBit1=0;staticunsignedcharBit2=0;stati

4、cunsignedcharBit3=0;staticunsignedcharBit4=0;staticunsignedcharBit5=0;staticunsignedcharBit6=0;staticunsignedcharTrouch=0;sbitP10=P1^0;//四个数码管的位码口定义sbitP27=P2^7;sbitP26=P2^6;sbitP25=P2^5;sbitP24=P2^4;sbitP23=P2^3;sbitP20=P2^0;sbitP21=P2^1;sbitP3_2=P3^2;sbitP11=P1^1;sbitP12=P1^2;sbitP13=P1

5、^3;sbitP14=P1^4;//四个数码管的位码口定义sbitP15=P1^5;sbitP16=P1^6;sbitP17=P1^7;voiddelay(inti){unsignedinta,b;for(a=i;a>0;a--);for(b=100;b>0;b--);}voidchange6(){P26=0;P25=0;delay(150000);do{if(P21==0)Bit6++;if(Bit6==2)Bit6=0;P0=Duan[Data_Buffer[Bit1]];//开段码P1=0xdf;delay(50);P0=Duan[Data_Buffer[Bit2]

6、];P1=0xef;delay(50);//先关位码P0=Duan[Data_Buffer[Bit3]];//开段码P1=0xf7;delay(50);P0=Duan[Data_Buffer[Bit4]];P1=0xfb;delay(50);//先关位码P0=Duan[Data_Buffer[Bit5]];//开段码P1=0xfd;delay(50);P0=Duan[Data_Buffer[Bit6]];P1=0xfe;delay(50);}while(P20==1);P26=1;P25=1;delay(25000);}voidchange5(){P24=0;P26=0;

7、delay(150000);do{if(P21==0)Bit5++;if(Bit5==4)Bit5=0;P0=Duan[Data_Buffer[Bit1]];//开段码P1=0xdf;delay(50);P0=Duan[Data_Buffer[Bit2]];P1=0xef;delay(50);//先关位码P0=Duan[Data_Buffer[Bit3]];//开段码P1=0xf7;delay(50);P0=Duan[Data_Buffer[Bit4]];P1=0xfb;delay(50);//先关位码P0=Duan[Data

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。