ct107d可调时钟(带闹铃_主控stc89c52rc)

ct107d可调时钟(带闹铃_主控stc89c52rc)

ID:28639959

大小:2.11 MB

页数:43页

时间:2018-12-12

ct107d可调时钟(带闹铃_主控stc89c52rc)_第1页
ct107d可调时钟(带闹铃_主控stc89c52rc)_第2页
ct107d可调时钟(带闹铃_主控stc89c52rc)_第3页
ct107d可调时钟(带闹铃_主控stc89c52rc)_第4页
ct107d可调时钟(带闹铃_主控stc89c52rc)_第5页
资源描述:

《ct107d可调时钟(带闹铃_主控stc89c52rc)》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库

1、l电路原理图:lPCB电路图:l电路板3D效果图:LED灯退出确定减加闹钟调时DS1302LCD1602插槽STC89C52RCLED对比度调节蜂鸣器正面(直插LCD1602,键盘,LED灯)背面(主控芯片,lcd对比度调节,蜂鸣器)l主程序:#include#include"lcd1602.h"#include"ds1302.h"sbitadd=P3^0;sbitsub=P3^1;sbitchooset=P3^2;sbitchoosec=P3^3;sbitok=P3^4;sbitout=P3^5;sbitbuzz=P2^2;sbitrelay=P2^4;unsignedch

2、arwelcome1[]=">>>Welcome<<<";unsignedcharwelcome2[]="____";unsignedintdd=0,c,t,flag1=0,flag,adjust,i,sec,min,hour,day,month,week,year,shi,fen,miao,nian,yue,ri,zhou,n,y,r,z,s,f,m;voiddelay5ms(void)//误差0us{unsignedchara,b;for(b=19;b>0;b--)for(a=130;a>0;a--);}voiddelay1s(unsignedintd)//误差0us{unsignedch

3、ara,b,c;while(d>0){for(c=167;c>0;c--)for(b=171;b>0;b--)for(a=16;a>0;a--);d--;}}voidDs1302_init(){Ds1302_Single_Byte_Write(0x8e,0);Ds1302_Single_Byte_Write(0x80,55);Ds1302_Single_Byte_Write(0x8e,0);Ds1302_Single_Byte_Write(0x82,59);Ds1302_Single_Byte_Write(0x8e,0);Ds1302_Single_Byte_Write(0x84,11);Ds

4、1302_Single_Byte_Write(0x8e,0);Ds1302_Single_Byte_Write(0x86,21);Ds1302_Single_Byte_Write(0x8e,0);Ds1302_Single_Byte_Write(0x88,2);Ds1302_Single_Byte_Write(0x8e,0);Ds1302_Single_Byte_Write(0x8a,7);Ds1302_Single_Byte_Write(0x8e,0);Ds1302_Single_Byte_Write(0x8C,16);}voiddisplay(){while(1){Ds1302_Singl

5、e_Byte_Write(0x8f,0);sec=Ds1302_Single_Byte_Read(0x81);Ds1302_Single_Byte_Write(0x8f,0);min=Ds1302_Single_Byte_Read(0x83);Ds1302_Single_Byte_Write(0x8f,0);hour=Ds1302_Single_Byte_Read(0x85);Ds1302_Single_Byte_Write(0x8f,0);day=Ds1302_Single_Byte_Read(0x87);Ds1302_Single_Byte_Write(0x8f,0);month=Ds13

6、02_Single_Byte_Read(0x89);Ds1302_Single_Byte_Write(0x8f,0);week=Ds1302_Single_Byte_Read(0x8b);Ds1302_Single_Byte_Write(0x8f,0);year=Ds1302_Single_Byte_Read(0x8d);write_command(0x80+2);write_data(year/10%10+48);write_data(year%10+48);write_command(0x80+5);write_data(month/10%10+48);write_data(month%1

7、0+48);write_command(0x80+8);write_data(day/10%10+48);write_data(day%10+48);write_command(0x80+14);write_data(week+48);write_command(0x80+0x40+8);write_data(hour/10%10+48);write_data(hour%10+48);write_

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

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

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