您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > 电子万年历设计(李艳)
0莱芜职业技术学院毕业论文电子万年历设计入学日期:2008年9月论文完成日期:2011年5月系别:信息工程系专业:电子信息技术工程学生姓名:赵彦丽指导教师:张国栋学号代码:43708学号:2008060101361摘要本设计以数字集成电路技术为基础,单片机技术为核心。软件设计采用模块化结构,汇编语言编程。系统通过LCD显示数据,可以显示公历日期(年、月、日、时、分、秒)以及星期。在内容安排上首先描述系统硬件工作原理,着重介绍了各硬件接口技术和各个接口模块的功能;其次,详细的阐述了程序的各个模块和实现过程。关键词:单片机;万年历;DS1302;LCM16022目录摘要·························································································1前言·························································································0第一章设计要求········································································1第二章方案论证与设计·······························································12.1控制器部分方案论证·························································12.2显示部分的方案论证························································02.3系统设计·······································································12.3.1晶体振荡器电路······················································12.3.2分频器电路····························································02.3.3时间计数器电路······················································02.3.4时钟电路·······························································02.3.5复位电路····························································12.3.6复位电路的可靠性设计············································12.3.7按键部分·······························································02.3.8蜂鸣器电路·····························································02.3.9根据各模块的功能互相连接成电子万年历的控制电路······0第三章各硬件介绍·····································································03.1AT89S51的引脚说明·······················································03.2发光二极管指示电路设计··················································03.3蜂鸣器电路设计······························································03.3.1蜂鸣器的介绍·························································03.4LCM1602简介······························································13.5DS1302简介···································································1第四章系统硬件设计所需的器材···················································0第五章系统软件总体设计····························································05.1公历与星期的换算方法····················································0第六章系统功能介绍··································································06.1按键处理·······································································06.2星期计算········································································0第七章主程序流程图··································································1第八章安装制作········································································1第九章调试与检测安全·······························································09.1供电安全······································································09.2测量仪器安全································································039.3几个必须记住的安全操作观念············································0第十章结束语···········································································1参考资料···················································································1致谢·························································································0前言电子万年历是实现对年,月,日,时,分,秒数字显示的计时装置,广泛用于个人家庭,车站,码头,办公室,银行大厅等场所,成为人们日常生活中的必需品。数字集成电路的发展和石英晶体振荡器的广泛应用,使得数字钟的精度远远超过老式钟表。钟表的数字化给人们生产生活带来了极大的方便,在此基础上完成的万年历精度高,功能易于扩展。可扩展成为诸如定时自动报警、按时自动打铃、时间程序自动控制、定时广播、自动起闭路灯、定时开关烘箱、通断动力设备、甚至各种定时电气的自动启用等电路。所有这些,都是以钟表数字化为基础的。因此,研究数字时钟及扩大其应用有着非常现实的意义。本设计就是数字时钟简单的扩展应用。莱芜职业技术学院毕业论文第一章设计要求4第一章设计要求本设计准备实现的功能:(1)显示公历日期功能(年、月、日、时、分、秒以及星期)(2)可通过按键切换年、月、日及时、分、秒的显示状态(3)可随时调校年、月、日或时、分、秒(4)可每次增减一进行时间调节(5)可动态完整显示年份,实现真正的万年历显示第二章方案论证与设计2.1控制器部分方案论证方案一:可采用ALTERA公司的FLEX10K系列PLD器件。设计起来结构清晰,各个模块,从硬件上设计起来相对简单,控制与显示的模块间的连接也会比较方便。但是考虑到本设计的特点,EDA在功能扩展上比较受局限,而且EDA占用的资源也相对多一些。从成本上来讲,用可编程逻辑器件来设计也没有什么优势。方案二:凌阳16位单片机有丰富的中断源和时基。它的准确度相当高,并且C语言和汇编兼容的编程环境也很方便来实现一些递归调用。I/O口功能也比较强大,方便使用。用凌阳16位单片机做控制器最有特色的就是它的可编程音频处理,可完成语音的录制播放和识别。这些都方便对设计进行扩展,使设计更加完善。成本也相对低一些。但是,在控制与显示的结合上有些复杂,显示模组资源相对有限,而且单片机的稳定性不是很高,而且就莱芜职业技术学院毕业论文第二章方案论证与设计5需要完成万年历这个不太复杂的设计可以不必用凌阳16位单片机来完成,采用51单片机既能够实现既定功能,成本也不高。综合考虑最后选择用51单片机来作为中心控制器件。硬件控制电路主要用了AT89S51芯片处理器、LCD显示器等。根据各自芯片的功能互相连接成电子万年历的控制电路。软件控制程序主要有主控程序、电子万年历的时间控制程序、时间显示及星期显示程序等组成。主控程序中对整个程序进行控制,进行了初始化程序及计数器、还有键盘功能程序、以及显示程序等工作,时间控制程序是电子万年历中比较重要的部分。时间控制程序体现了年、月、日、时、分、秒及星期的计算方法。时间控制程序主要是定时器0计时中断程序每隔10ms中断一次当作一个计数,每中断一次则计数加1,当计数100次时,则表示1秒到了,秒变量加1,同理再判断是否1分钟到了,再判断是否1小时到了,再判断是否1天到了,再判断是否1月到了,再判断是否1年到了,若计数到了则相关变量清除0。先给出一般年份的每月天数。如果是闰年,第二个月天数不为28天,而是29天。再用公式s=v-1+〔(y-1/4〕-〔(y-1/100〕+〔(y-1/400〕+d计算当前显示日期是星期几,当调节日期时,星期自动的调整过来。闰年的判断规则为,如果该年份是4或100的整数倍或者是400的整数倍,则为闰年;否则为非闰年。在我们的这个设计中由于只涉及100年范围内,所以判断是否闰年就只需要用该年份除4来判断就行了。温度的显示主要是靠ds18b20采集现在的温度数据,CPU读取数据进行显示,当各自的条件得不到满足时,对应的显示器状态就不发生改变,只是在满足条件的情况下,显示器的状态才变化。莱芜职业技术学院毕业论文第二章方案论证与设计6图1单片机控制电路Fig.1SCMControlcircuit2.2显示部分的方案论证方案一:采用8段数码管虽经济实惠,但操作比液晶显示来说略显繁琐。方案二:液晶显示方式。液晶显示效果出众,可以运用菜单项来方便操作,比较简单,所以,最后选择液晶显示方案。莱芜职业技术学院毕业论文第二章方案论证与设计7图2液晶显示电路Fig.2lcm1602circuit2.3系统设计2.3.1晶体振荡器电路晶体振荡器电路给数字钟提供一个频率稳定准确的32768Hz的方波信号,可保证数字钟的走时准确及稳定。不管是指针式的电子钟还是数字显示的电子钟都使用了晶体荡器电路。莱芜职业技术学院毕业论文第二章方案论证与设计8图3DS1302电路Fig.3ds1302circuit2.3.2分频器电路分频器电路将高频方波信号经分频后得到1Hz的方
本文标题:电子万年历设计(李艳)
链接地址:https://www.777doc.com/doc-73749 .html