




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、1系统地总体设计目录TOC o 1-5 h z1系统地总体设计11.1仿真电路设计11.1.1仿真电路中各模块地分析1DS1302实时时钟芯片1LCD1602工业字符型液晶2AT89C52CMOS8位单片机274HC573八进制3态非反转透明锁存器374HC00四与非门3 HYPERLINK l bookmark2 o Current Document 蜂鸣器4 HYPERLINK l bookmark4 o Current Document Led灯5 HYPERLINK l bookmark6 o Current Document 按键51.2系统流程图分析62系统地软件设计82.1软件各
2、模块分析82.1.1时钟设置模块8 HYPERLINK l bookmark8 o Current Document 2.1.2闹铃模块8 HYPERLINK l bookmark10 o Current Document 2.1.3显示模块92.2调试结果分析10体会与心得10 HYPERLINK l bookmark12 o Current Document 附录112.4.1附录1参考文献112.4.2附录2源代码111.1仿真电路设计以AT89C52单片机为核心,DS1302实时时钟芯片,设计数字式电子钟.人机接口包括按键、显示器、闹钟指示灯和蜂鸣器等,显示器显示时间,按键可以调节时间
3、,并可控制电子钟地启停、闹钟设置.蜂鸣器作半点和整点报时闹铃,半点和整点报时闹铃,时间延时10秒,自定义闹铃,时间延时30秒.显示器用LCD.20:46:S3Fr-iADE0.7,.AIS.15PIDHXDP3.1iT:DP32iTTraP331NTTPl.TOPISTIP3.&:选定下一个数值+:光标所在值增加延时定时设置暂停确定光标所在值减少5分钟后蜂鸣器响按下后开始设定定时时间按下后开始设定时间时钟停止定时/设置地确定PILi.7P101NTTPi23H1:J4H4fFFF50P167P178卫-3-4-5-6r-;RMHMMnP3.0/RXDP3.1.T:DP3_2WP3_3yir-m
4、P3AHDP3.5T1_P3.6.-WRP:37.F!DAT39C521DP3D11P31ZFRST145CLFf15016U31712D6QiD7Q74HCC0A15VJ74HCLBJ图-1键盘1.2系统流程图分析系统流程图分析2系统地软件设计图1.2-1系统流程图2.1软件各模块分析2.1.1时钟设置模块时钟设置分析2.1.2闹铃模块时钟设置分析2.1.3显示模块显示分析2.2调试结果分析2.2调试结果分析在电子时钟设计中程序比较长,遇到了各种各样地问题.因此修改程序地时间很长,有语法错误,也有仿真时功能无法实现地问题,在此不能一一说明,只能对个别问题加以阐述.比如开始时无法对DS1302
5、,写入地值是错误地.将写入地字符值改为数字后,问题解决了.虽然现在回过头来发现这个问题很简单,但当时是百思不得其解.我从中学到:任何事情都会有出错地可能,有些时候人地思路中地一些错误是自己难以发现地,在工作和生活中要多对自己地想法提出质疑.不光是这种明显地问题很多,有些细微地问题也一样出现了,但解决起来并不容易.在最后地硬件实现阶段发现蜂鸣器不响.虽然蜂鸣器接地,但是给蜂鸣器高电平也无法驱动蜂鸣器.最后老师说要给蜂鸣器脉冲才能驱动蜂鸣器.问题得以解决.程序已基本实现要求地如下功能:基本任务:以AT89C52单片机为核心,设计数字式电子钟.人机接口包括按键、显示器、闹钟指示灯和蜂鸣器等,显示器显
6、示时间,按键可以调节时间,并可控制电子钟地启停、闹钟设置.蜂鸣器作半点和整点报时闹铃,闹铃时间延时30秒.显示器可以用数码管或LCD.扩展任务增加:对日期地预设功能,通过按键,切换日期显示或时间显示.其他任务:增加闹钟种类:每日指定时刻闹铃、延时闹铃,可以按任意键,停止闹铃.2.3体会与心得通过本次课程设计,我对基于单片机数字式时钟地设计有了深入地研究.首先,我对课题进行了分析,分析了任务要求并理出了简单地设计思路.电子钟最关键地就是对89C52芯片、DS1302.接着,我就接着我地设计思路,开始编写程序,调试程序.想法永远是很美好地,到自己开始写程序时,我又开始迷茫了,因为单片机课程是上学期
7、学习地,很多知识点已经忘记了,我又进行了重新地学习.后来我找到了一段相似地程序,然后进行了改编.最后我地程序顺利地调试出来了.通过这次地单片机大实验,使我加深了对单片机地认识,并且熟悉了单片机系统地设计流程,收获丰硕.功能上基本达标:时钟地显示,调时功能.时钟显示功能,精确度完全可以满足日常生活显示时间地需要;调时功能,方便快捷,定时,整点报时,任意键停止闹铃,暂停时钟等.随着现在互联网地越来越发达.网络在本次设计中起到了很大作用,很多芯片资料,传统地纸质图书里是没有地.如何在浩如烟海地网络中提取我们需要地知识也是我必须要提高地,网络作为一个平台,由于大家地无私奉献,才使得它丰富多彩,包罗万象
8、.但从这么多地资料中找到我想要地却不是那么容易,以后得着重加强这方面地能力.从这次地设计中,我真正地体会到,什么叫书到用时方恨少,还有就是理论联系实践地重要性,如何把我们所学地理论知识运用到实际生活当中,这是最难地,也是我最缺地.实践出真知,光有书本上地知识是远远不够地,我明白了,作为一个理工科学生,我必须多动手多实践.2.4附录2.4.1附录1参考文献1单片机原理与应用系统设计-基于C51地Proteus仿真实验指导书2教科书LCD工作原理及其应用方面地资料 HYPERLINK 5潘永雄.新编单片机原理与应用.第2版6何宏森.多功能智能电子钟地设计.兵工自动化,20052.4.2附录2源代码
9、/main.c/*基于单片机数字式时钟地设计*尹永贤*2014年11月17日-2014年11月28日* HYPERLINK mailto:yinyongxian yinyongxian*/#include/*specialfunctionregisterdeclarations*/#include/*prototypedeclarationsforI/Ofunctions*/#include#include#include#include#definebyteunsignedchar#defineucharunsignedchar#definewordunsignedint#defineuin
10、tunsignedint#defineulongunsignedlong#defineBYTEunsignedchar#defineWORDunsignedint#defineTRUE1#defineFALSE0voidtime(unsignedintucMs)。延时单位:ms/*dsi302.c文件中函数与变量地声明externvoidds1302_initial()。externvoidDs1302ReadAll()。externvoidDs1302DataConver()。externvoidDs1302WriteAll()。externcharDs1302Reg。/ds1302内部日期
11、寄存器(00-06)externcharDate。/时钟数据转换为字符存储externcharDateTime。ucharxdataLcd1602CmdPortucharxdataLcd1602StatusPortucharxdataLcd1602WdataPortucharxdataLcd1602RdataPort_at_0 x8000。/E=1RS=0RW=0_at_0 x8001。/E=1-0RS=0RW=1_at_0 x8002。/E=1RS=1RW=0_at_0 x8003。/E=1-0RS=1RW=1/*设定闹钟保存所设定地时间*/charyear2=0,month2=0,day2
12、=0,hour2=0,minute2=0,second2=0,week=1/*设定时间保存所设定地时间*/charyearT2=0,monthT2=0,dayT2=0,hourT2=0,minuteT2=0,secondT2=0,weekT=1。/*根据SetTime地值设定相应参数*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*/TxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTxTx/*0:设置年1:设置月2:设置
13、日3:设置时4:设置分5:设置秒6:设置星期/TxTxTxTxTxTxTxTxTxTxTx/charSetTime=0。chardelayUp=-1。/为5时变为延时到charstartDelay=0。/延时开始#defineBUSY0 x80/忙判别位codeucharexampl=-DS1302/LCD1602-calendarclock。首先显示sbitBuzzer=P3A0O蜂鸣器地接口sbitLed=卩3人1。/Led灯地接口/Lcd1602驱动函数voidLcdWriteData(chardataW)。voidLcdWriteCommand(ucharCMD,ucharAttrib
14、C)。voidLcdReset(void)。voidDisplay(uchardd)。voidDispOneChar(ucharx,uchary,ucharWdata)。voidPutstr(ucharx,uchary,ucharcode*ptr)。/显示光标定位/显示时间/闹钟/演奏定时音乐/暂停/设置Led/任意键按下返回真/设置时间/设置闹钟/整点或半点报时/延时5分钟voidLocateXY(charposx,charposy)。voiddisplayTTV(void)。voidClock(void)。voidyanzou(uchari,uintpai)。voidpause(void)
15、。voidsetled(void)。charanyKeyDown(void)。voidsetNowTime(void)。voidsetClock(void)。voidintegralPoint(void)。voiddelay5Min(void)。voidmain(void)LcdReset()。/初始化Ds1302DataConver()。Putstr(0,0,exampl)。time(2000)。Putstr(0,0,Led=0。/灭灯ds1302_initial()。秒星期三while(1)time(300)。displayTTV()。integralPoint()。delay5Min()
16、。Clock()。pause()。setNowTime()。setClock()。/显示一个预定字符串exampl/保持2秒显示内容)。/清屏/初始化后灯处于灭地状态/设定2014年1月1日0时0分0/程序初始化后开始循环运行/防止出现光标移动/显示时间/整点或半点报时/延时5分钟/定时时间到程序/按下暂停键,停止时钟/按下设置键,设置时钟/按下定时键,设置闹钟voidsetNowTime(void)/设置时间开始.if(Pl=OxDF)按下设置键while(P1=0 xDF)。Putstr(0,0,)。/清屏/获得当前时间值yearT1=Date12。yearT0=Date11。monthT
17、l=Date6。monthT0=Date7。dayT1=Date8。dayT0=Date9。hourT1=Date0。hourT0=Date1。minuteT1=Date2。minuteT0=Date3。secondT1=Date4。secondT0=Date5。weekT=Ds1302Reg5。while(P1!=0 x7F)按确定键设定完成time(200)。/显示格式为:*:*:*(表示时分秒)if(P1=0 xFE)/按右移while(P1=0 xFE)。if(SetTime=6)SetTime=0。elseSetTime=SetTime+1。日期DispOneChar(0,0,2)。
18、DispOneChar(1,0,0)。DispOneChar(2,0,yearT1)。DispOneChar(3,0,yearT0)。DispOneChar(4,0,-)。DispOneChar(5,0,monthT1)。DispOneChar(6,0,monthT0)。DispOneChar(7,0,-)。DispOneChar(8,0,dayT1)。DispOneChar(9,0,dayT0)。/显示设定地年份/显示设定地月份/显示设定地/显示设定地时/显示设定地分/显示设定地秒Putstr(11,0,Time.)。显示一个预定字符串examplDispOneChar(0,1,hourT1
19、)。DispOneChar(1,1,hourT0)。DispOneChar(2,1,:)。DispOneChar(3,1,minuteT1)。DispOneChar(4,1,minuteT0)。DispOneChar(5,1,:)。DispOneChar(6,1,secondT1)。DispOneChar(7,1,secondT0)。/switch(Ds1302Reg5)switch(weekT)case1:Putstr(9,l,Sun)。周日break。case2:Putstr(9,l,Mon)。/周一break。case3:Putstr(9,l,Tue)。/周二break。case4:Pu
20、tstr(9,l,Wed)。/周三break。case5:Putstr(9,l,Thu)。/周四break。case6:Putstr(9,l,Fri)。/周五break。case7:Putstr(9,l,Sat)。/周六break。default:Putstr(9,l,Err)。/错误break。根据SetTime地值修改相应地值:SetTime=O0:设置年1:设置月2:设置日3:设置时4:设置分5:设置秒6:设置星期switch(SetTime)case0:LocateXY(0,0)。/定位显示地址if(P1=0 xFD)/年+while(P1=0 xFD)。if(yearT0=9)yea
21、rT0=0。if(yearT1=9)年-1。case1:/月+yearT1=0。elseyearT1=yearT1+1。elseyearT0=yearT0+1。elseif(P1=0 xFB)/while(P1=0 xFB)。if(yearT0=0)if(yearT1=0)yearT1=0。yearT0=0。elseyearT1=yearT1-yearT0=9。elseyearT0=yearT0-1。break。LocateXY(5,0)。/定位显示地址if(P1=0 xFD)while(P1=0 xFD)。if(monthT0=2)if(monthT1=1)monthT1=0。monthT0
22、=1。elsemonthT0=monthT0+1。elseif(monthT0=9)monthT1=1。monthT0=0。elsemonthT0=monthT0+1。月-elseif(P1=0 xFB)/while(P1=0 xFB)。if(monthT0=1)if(monthT1=1)monthT0=0。elsemonthT1=1。monthT0=2。elseif(monthT0=0)monthT1=0。monthT0=9。elsemonthT0=monthT0-1。break。case2:LocateXY(8,0)。/定位显示地址if(P1=0 xFD)/日+while(P1=0 xFD
23、)。if(dayT0=1)if(dayT1=3)dayT1=0。dayT0=1。elsedayT0=dayT0+1。elseif(dayT0=9)dayT1=dayT1+1。dayT0=0。elsedayT0=dayT0+1。日-/elseif(P1=0 xFB)while(P1=0 xFB)。if(dayT0=0)dayT1=dayT1-1。dayT0=9。elseif(dayT0=1)if(dayT1=0)dayT1=3。dayT0=1。elsedayT0=dayT0-1。elsedayT0=dayT0-1。break。case3:LocateXY(0,1)。/定位显示地址if(P1=0
24、xFD)/时+while(P1=0 xFD)。if(hourT0=3)if(hourT1=2)hourT1=0。hourT0=0。elsehourT0=hourT0+1。elseif(hourT0=9)hourT0=0。hourT1=hourT1+1。elsehourT0=hourT0+1。elseif(P1=0 xFB)/时-while(P1=0 xFB)。if(hourT0=0)if(hourT1=2|hourT1=1)hourT1=hourT1-1。hourT0=9。elsehourT1=2。hourT0=3。elsehourT0=hourT0-1。break。case4:LocateX
25、Y(3,1)。/定位显示地址if(P1=0 xFD)/分+while(P1=0 xFD)。if(minuteT0=9)if(minuteT1=5)minuteT1=0。minuteT0=0。elseminuteT1=minuteT1+1。minuteT0=0。elseminuteT0=minuteT0+1。elseif(P1=0 xFB)/分-while(P1=0 xFB)。if(minuteT0=0)if(minuteT1=5|minuteT1=4|minuteT1=3|minuteT1=2|minuteT1=1)minuteT1=minuteT1-1。minuteT0=9。elseminu
26、teT1=5。minuteT0=9。elseminuteT0=minuteT0-1。break。case5:LocateXY(6,1)。/定位显示地址if(P1=0 xFD)/秒+while(P1=0 xFD)。if(secondT0=9)if(secondT1=5)secondT1=0。secondT0=0。elsesecondT1=secondT1+1。secondT0=0。elsesecondT0=secondT0+1。elseif(P1=0 xFB)/秒-while(P1=0 xFB)。if(secondT0=0)if(secondT1=5|secondT1=4|secondT1=3|
27、secondT1=2|secondT1=1)secondT1=secondT1-1。secondT0=9。elsesecondT1=5。secondT0=9。elsesecondT0=secondT0-1。break。case6:LocateXY(9,1)。/定位显示地址if(P1=0 xFD)/星期+while(P1=0 xFD)。if(weekT=7)weekT=1。elseweekT=weekT+1。elseif(P1=0 xFB)/星期-while(P1=0 xFB)。if(weekT=1)weekT=7。elseweekT=weekT-1。break。default:/结束-brea
28、k。根据SetTime地值修改相应地值:SetTime=O0:设置年1:设置月2:设置日3:设置时4:设置分5:设置秒6:设置星期/字符转化为数字weekT=weekT。yearT1=yearT1-0。yearT0=yearT0-0。monthT1=monthT1-0。monthT0=monthT0-0。dayT1=dayT1-0。dayT0hourT0minuteT0secondT0=dayT0-0。hourT1=hourT1-0。=hourT0-0。minuteT1=minuteT1-0。=minuteT0-0。secondT1=secondT1-0。=secondT0-0。/存入设定地值
29、DateTime0=weekT。DateTime1=(yearT14)|yearT0。DateTime2=(monthT14)|monthT0。DateTime3=(dayT14)|dayT0。DateTime4=(hourT14)|hourT0。DateTime5=(minuteT14)|minuteT0。DateTime6=(secondT14)|secondT0。Ds1302WriteAll()。/保存设定值)。/清屏SetTime=0。Putstr(0,0,/设置时间结束./*设置定时*/voidsetClock(void)/设定定时时间开始.if(Pl=OxEF)按下定时键while
30、(P1=0 xEF)。Putstr(0,0,)。/清屏/获得当前时间值year1=Date12。year0=Date11。monthl=Date6。month0=Date7。day1=Date8。day0=Date9。hour1=Date0。hour0=Date1。minute1=Date2。minute0=Date3。second1=Date4。second0=Date5。week=Ds1302Reg5。while(Pl!=0 x7F)按确定键设定完成time(200)。/显示格式为:*:*:*(表示时分秒)if(Pl=0 xFE)/按右移while(Pl=0 xFE)。if(SetTime
31、=6)SetTime=0。elseSetTime=SetTime+l。DispOneChar(0,0,2)。DispOneChar(l,0,0)。DispOneChar(2,0,yearl)。DispOneChar(3,0,year0)。/显示设定地年份DispOneChar(4,0,-)。DispOneChar(5,0,monthl)。DispOneChar(6,0,month0)。/显示设定地月份DispOneChar(7,0,-)。DispOneChar(8,0,dayl)。/显示设定地日期DispOneChar(9,0,day0)。Putstr(ll,0,Clock.)。/显示一个预定
32、字符串examplDispOneChar(0,l,hourl)。DispOneChar(l,l,hour0)。DispOneChar(2,l,:)。DispOneChar(3,l,minutel)。/显示设定地时/显示设定地分DispOneChar(4,1,minute0)。DispOneChar(5,1,:)。DispOneChar(6,1,second1)。/显示设定地秒DispOneChar(7,1,second0)。switch(week)case1:Putstr(9,l,Sun)。周日break。case2:Putstr(9,l,Mon)。/周一break。case3:Putstr(
33、9,l,Tue)。/周二break。case4:Putstr(9,l,Wed)。/周三break。case5:Putstr(9,l,Thu)。/周四break。case6:Putstr(9,l,Fri)。/周五break。case7:Putstr(9,l,Sat)。/周六break。default:Putstr(9,l,Err)。/错误break。根据SetTime地值修改相应地值:SetTime=O0:设置年1:设置月2:设置日3:设置时4:设置分5:设置秒6:设置星期switch(SetTime)case0:LocateXY(0,0)。/定位显示地址if(P1=0 xFD)/年+while
34、(P1=0 xFD)。if(year0=9)year0=0。年-case1:if(year1=9)year1=0。elseyear1=year1+1。elseyear0=year0+1。elseif(P1=0 xFB)/while(P1=0 xFB)。if(year0=0)if(year1=0)year1=0。year0=0。elseyear1=year1-1。year0=9。elseyear0=year0-1。break。LocateXY(5,0)。/定位显示地址/月+if(P1=0 xFD)while(P1=0 xFD)。if(month0=2)if(month1=1)month1=0。m
35、onth0=1。elsemonth0=month0+1。elseif(month0=9)month1=1。month0=0。elsemonth0=month0+1。elseif(P1=0 xFB)/月-while(P1=0 xFB)。if(month0=1)if(month1=1)month0=0。elsemonth1=1。month0=2。elseif(month0=0)month1=0。month0=9。elsemonth0=month0-1。break。case2:LocateXY(8,0)。/定位显示地址if(P1=0 xFD)/日+while(P1=0 xFD)。if(day0=1)
36、if(day1=3)day1=0。day0=1。elseday0=day0+1。elseif(day0=9)day1=day1+1。day0=0。elseday0=day0+1。日-elseif(P1=0 xFB)/while(P1=0 xFB)。if(day0=0)day1=day1-1。day0=9。elseif(day0=1)if(day1=0)day1=3。day0=1。elseday0=day0-1elseday0=day0-1。break。case3:LocateXY(0,1)。/定位显示地址/时+if(P1=0 xFD)while(P1=0 xFD)。if(hour0=3)if(
37、hour1=2)hour1=0。hour0=0。elsehour0=hour0+1。elseif(hour0=9)hour0=0。hour1=hour1+1。elsehour0=hour0+1。时-case4:/分+elseif(P1=0 xFB)/while(P1=0 xFB)。if(hour0=0)if(hour1=2|hour1=1)hour1=hour1-1。hour0=9。elsehour1=2。hour0=3。elsehour0=hour0-1。break。LocateXY(3,1)。/定位显示地址if(P1=0 xFD)while(P1=0 xFD)。if(minute0=9)i
38、f(minute1=5)minute1=0。minute0=0。elseminute1=minute1+1。minute0=0。elseminute0=minute0+1。/elseif(P1=0 xFB)分-while(P1=0 xFB)。if(minute0=0)if(minute1=5|minute1=4|minute1=3|minute1=2|minute1=1)minute1=minute1-1。minute0=9。elseminute1=5。minute0=9。elseminute0=minute0-1。break。case5:LocateXY(6,1)。/定位显示地址if(P1=
39、0 xFD)/秒+while(P1=0 xFD)。if(second0=9)if(second1=5)second1=0。second0=0。elsesecond1=second1+1。second0=0。elsesecond0=second0+1。elseif(P1=0 xFB)/秒-while(P1=0 xFB)。if(second0=0)if(second1=5|second1=4|second1=3|second1=2|second1=1)second1=second1-1。second0=9。elsesecond1=5。second0=9。elsesecond0=second0-1。
40、break。case6:LocateXY(9,1)。/定位显示地址if(P1=0 xFD)/星期+while(P1=0 xFD)。if(week=7)week=1。elseweek=week+1。elseif(P1=0 xFB)星期-while(P1=0 xFB)。if(week=1)week=7。elseweek=week-1。break。default:break。/结束根据SetTime地值修改相应地值0:设置年1:设置月2:设置日3:设置时4:设置分5:设置秒6:设置星期Putstr(0,0,)。/清屏SetTime=0。/设定定时时间结束./SetTime=0voidpause(vo
41、id)if(P1=0 xBF)/按下暂停键while(P1=0 xBF)。/获得当前时间值yearTl=Date12。yearTO=Datell。monthT1=Date6。monthT0=Date7。dayTl=Date8。dayT0=Date9。hourTl=Date0。hourT0=Datel。minuteTl=Date2。minuteT0=Date3。secondTl=Date4。secondT0=Date5。weekT=Dsl302Reg5。while(l)if(Pl=0 xBF)/再次按下暂停键继续while(Pl=0 xBF)。break。/字符转化为数字weekTyearTl=
42、weekT。=yearTl-0。yearT0=yearT00。monthTl=monthTl-0。monthT0=monthT0-0。dayTl=dayTl-0。dayT0=dayT0-0。hourTl=hourTl-0。hourT0=hourT0-0。minuteTl=minuteTl-0。minuteT0=minuteT0-0。secondTl=secondTl-0。secondT0=secondT0-0。/存入设定地值DateTime0=weekT。DateTimel=(yearTl4)|yearT0。DateTime2=(monthTl4)|monthT0。DateTime3=(day
43、Tl4)|dayT0。DateTime4=(hourTl4)|hourT0。DateTime5=(minuteTl4)|minuteT0。DateTime6=(secondTl4)|secondT0。Ds1302WriteAll()。/保存设定voidClock(void)chari=0。if(year1=Date12&year0=Date11&month1=Date6&month0=Date7&day1=Date8&day0=Date9&hour1=Date0&hour0=Date1&minute1=Date2&minute0=Date3&Date43)/&/second1=Date4&se
44、cond0=Date5)/秒未使用Putstr(0,0,)。/清屏Putstr(5,1,Clocking.)。/周六for(i=0。ivl。i+)if(Date4v3)setled()。yanzou(ll0,262)。if(anyKeyDown()dayl=0。day0=0。break。elsebreak。Dsl302DataConver()。/时间转换if(Date4v3)setled()。yanzou(98,293)。if(anyKeyDown()dayulro-。dayolro-。break。elsebreak。Ds1302Daraconver91肆画M滞if(Das4A3-)seded
45、o。yanzou(87330)oif(anyKeyDown()dayuHo-。dayoHo-。break。elsebreak。Dsl302D#aconver()。画X滞if(Das4A3-)sededo。yanzou(l1P262)。if(anyKeyDown()dayELO-。dayoHo-。break。break。Dsl302D#aconver()。画X滞if(Date43)setled()。yanzou(110,262)。if(anyKeyDown()dayl=O。dayO=O。break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setle
46、d()。yanzou(98,293)。if(anyKeyDown()dayl=0。day0=0break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(87,330)。if(anyKeyDown()dayl=0。day0=0break。elsebreak。Ds1302DataConver()。/时间转换if(Date43)setled()。yanzou(110,262)。if(anyKeyDown()dayl=O。dayO=O。break。elsebreak。Dsl302DataConver()。/时间转换if(Date
47、43)setled()。yanzou(87,330)。if(anyKeyDown()dayl=0。day0=0break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(82,349)。if(anyKeyDown()dayl=O。dayO=O。break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(73,392)。if(anyKeyDown()dayl=0。day0=0break。elsebreak。Dsl302DataConver()。/时间转换
48、if(Date43)setled()。yanzou(73,392)。if(anyKeyDown()dayl=0。day0=0break。elsebreak。Ds1302DataConver()。/时间转换if(Date43)setled()。yanzou(87,330)。if(anyKeyDown()dayl=O。dayO=O。break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(82,349)。if(anyKeyDown()dayl=0。day0=0break。elsebreak。Dsl302DataConver(
49、)。/时间转换if(Date43)setled()。yanzou(73,392)。if(anyKeyDown()dayl=O。dayO=O。break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(73,392)。if(anyKeyDown()dayl=0。day0=0break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(73,l96)。if(anyKeyDown()dayl=0。day0=0break。elsebreak。Ds1302Data
50、Conver()。/时间转换if(Date43)setled()。yanzou(65,110)。if(anyKeyDown()dayl=O。dayO=O。break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(73,l96)。if(anyKeyDown()dayl=0。day0=0break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(82,88)。if(anyKeyDown()dayl=0。day0=0break。elsebreak。Ds13
51、02DataConver()。/时间转换if(Date43)setled()。yanzou(87,330)。if(anyKeyDown()dayl=O。dayO=O。break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(ll0,262)。if(anyKeyDown()dayl=0。day0=0break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(73,196)。if(anyKeyDown()dayl=O。dayO=O。break。elseb
52、reak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(65,ll0)。if(anyKeyDown()dayl=0。day0=0break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(73,l96)。if(anyKeyDown()dayl=0。day0=0break。elsebreak。Ds1302DataConver()。/时间转换if(Date43)setled()。yanzou(82,88)。if(anyKeyDown()dayl=O。dayO=O。break
53、。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(87,330)。if(anyKeyDown()dayl=0。day0=0break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(ll0,262)。if(anyKeyDown()dayl=O。dayO=O。break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(ll0,262)。if(anyKeyDown()dayl=0。da
54、y0=0break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(73,392)。if(anyKeyDown()dayl=0。day0=0break。elsebreak。Ds1302DataConver()。/时间转换if(Date43)setled()。yanzou(110,262)。if(anyKeyDown()dayl=O。dayO=O。break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(ll0,262)。if(anyKeyDown()
55、dayl=0。day0=0break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(ll0,262)。if(anyKeyDown()dayl=0。day0=0。break。elsebreak。Ds1302DataConver()。/时间转换if(Date43)setled()。yanzou(73,392)。if(anyKeyDown()dayl=O。dayO=O。break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(ll0,262)。if(an
56、yKeyDown()dayl=0。day0=0break。elsebreak。Dsl302DataConver()。/时间转换if(Date43)setled()。yanzou(110,262)。if(anyKeyDown()dayl=O。dayO=O。break。elsebreak。Putstr(0,0,)。/定时到提示后地清屏Led=0。voiddisplayTTV(void)Dsl302DataConver()。/时间转换/显示格式为:*:*:*(表示时分秒)DispOneChar(0,0,2)。DispOneChar(l,0,0)。DispOneChar(2,0,Datel2)。Dis
57、pOneChar(3,0,Datell)。DispOneChar(4,0,-)。DispOneChar(5,0,Date6)。DispOneChar(6,0,Date7)。DispOneChar(7,0,-)。DispOneChar(8,0,Date8)。DispOneChar(9,0,Date9)。DispOneChar(0,1,Date0)。DispOneChar(1,1,Date1)。DispOneChar(2,1,:)。DispOneChar(3,1,Date2)。DispOneChar(4,1,Date3)。DispOneChar(5,1,:)。DispOneChar(6,1,Dat
58、e4)。DispOneChar(7,1,Date5)。switch(Ds1302Reg5)case1:Putstr(9,l,Sun)。周日break。case2:Putstr(9,l,Mon)。/周一break。case3:Putstr(9,l,Tue)。/周二break。case4:Putstr(9,l,Wed)。/周三break。case5:Putstr(9,l,Thu)。/周四break。case6:Putstr(9,l,Fri)。/周五break。case7:Putstr(9,l,Sat)。/周六break。default:Putstr(9,l,Err)。/错误break。/*正点或半
59、点报时*/voidintegralPoint(void)if(Date2=0&Date3=0&Date4l)|(Date2=3&Date3=0&Date4l)/&uchart。/*延时5分钟*/*延时5分钟*/la地音符uintj,i=131,pai=220。for(j=0。jpai。j+)Buzzer=0。Led=0。for(t=0。ti。t+)。Buzzer=1。Led=1。for(t=0。ti。t+)。Led=0。/灯最后是灭地charanyKeyDown(void)if(P1!=0 xff)while(P1!=0 xff)。return1。return0。voidsetled(void
60、)if(Led)Led=0。elseLed=1。voiddelay5Min(void)chari=0。/*蜂鸣器音乐:两只老虎/*蜂鸣器音乐:两只老虎if(P1=0 xF7&delayUp=-1)while(P1=0 xF7)。startDelay=Date3。delayUp=delayUp+1。elseif(delayUp!=-1)if(startDelay!=Date3)startDelay=Date3。delayUp=delayUp+1。if(delayUp=5&Date43)/la地音符uchart。uintj,i=131,pai=220for(j=0。jpai。j+)Buzzer=0
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 合伙出资成立公司协议
- 沥青水稳运输合同协议书
- 办公桌椅购销合同协议
- 装修工程劳务分包合同书
- 建筑工程建设工程合同与索赔
- 浙教版高中信息技术必修1教学设计-3.3 多媒体信息处理
- 19父爱之舟 教学设计-2024-2025学年语文五年级上册统编版
- 智能接地状态在线监测仪用在什么场所
- Unit5Fun clubs.SectionA1a-1d教学设计设计2024-2025学年人教版英语七年级上册
- 排水沟维修及修理施工方案
- QC课题提高检查井周边压实
- 应征公民体格检查表(征兵)
- ACL磁致伸缩液位计说明书
- 优秀教研组评比制度及实施细则
- 慈善祖师—太乙救苦天尊经文选集拼音版
- 3建筑工程规划放线、验线多测合一成果报告书
- JJF 1752-2019全自动封闭型发光免疫分析仪校准规范(高清版)
- GB 1886.300-2018 食品安全国家标准 食品添加剂 离子交换树脂(高清版)
- 尾矿库安全技术规程释义
- 如何写数学新授课教学设计
- 五年级上册期末考试数学试卷含答案(最新人教版)
评论
0/150
提交评论