文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > 高等教育 > 工学 > Bell Clock System Based on STC12C5A16S2
侵权投诉

Bell Clock System Based on STC12C5A16S2

打铃时钟最小系统软硬件实现 基于单片机STC12C5A16S2 课程设计论文

基于STC12C5A16S2的打铃时钟最小系统

梁中法

1

(1.山东大学威海分校机电与信息工程学院,264209)

摘要:本文基于STC12C5A16S2单片机,DS1302时钟芯片计时、1602液晶屏显示.系统主要由单片机控制电路,显示电路以及时钟控制电路三个硬件模块和九个软件模块组成.本文阐述了系统的工作原理,各软件模块的功能及其实现过程,论证了设计方案理论的可行性.系统程序采用C语言编写,经Keil软件调试后执行,可以显示年、月、日、星期、时、分、秒.具有永不掉电和校准功能、闹钟和背光灯功能、日期时间设定和系统重置功能.定时器1中断实现秒表、倒计时,时间分辨率各达到0.01秒;按键消抖,菜单切换,闪烁标记修改.系统界面友好,功能多样,经测试稳定无漏洞.

关键词:打铃时钟;单片机;1602字符液晶;DS1302

Bell Clock System Based on STC12C5A16S2

Liang Zhong-fa1

(1.School of Mechnical,Electrical & Engineering,ShanDong University at Weihai,Weihai,ShanDong,264209,China)

Abstract:The course is based on the STC12C5A16S2, with the DS1302 clock chip timing, 1602 LCD displaying. The bell clock system is mainly composed of three hardware modules: the MCU control circuit, the display circuit and the correction circuit, and nine software modules are also included. The paper describes the functions of each interface module and its working process, demonstrates design theory is Feasibility. C language is used to program, after debugging in the Keil software, then writing into the chip and running in system, the system can correctly display year, month, day, week, hours, minutes, seconds. Backup battery is used to achieve clock, with no power off and calibration function, alarm clock and backlight lamp function, date and time setting and system resetting function. Timer 1 interrupt to achieve stopwatch and countdown, the time resolution reaches 0.01 seconds, with button buffeting extinction, scrolling menu to display, blinking to mark the bit to modify. The functions are diversity, interface is friendly, and the system can run stable without bugs after testing.

Keywords: Bell clock; MCU; 1602 LCD; DS1302

1、引言

该文主要对打铃时钟(万年历)进行仿真设计以及软硬

件实现.利用定时器、外部中断的设置和编程原理,对利用单片机C语言的一般开发流程进行初步探究.实现将单片机软硬件结合起来,对程序进行编辑,校验.

利用STC12C5A16S2单片机,1602字符液晶,DS1302时钟芯片实现最小系统的硬件架构.1602液晶工业字符型液晶,能够同时显示16x02即32个字符,具有16行、2列的显示功能,支持西文字符、汉字点阵,功能强大.DS1302时钟芯片提供时钟信号输入输出和后备电源供电.

本文提出了单片机应用系统的一般开发流程,用C语言编程实现最小系统,并对单片机内外时钟的调用有了本质的认识.最小系统拥有正确的万年历显示,闹铃,背光灯,时间设置,日期设置,恢复出厂设置,倒计时,秒表计时、暂停、清零功能,并同时可以用1602液晶屏显示,菜单动态切换,在科技与效率的信息时代具有较深刻的现实意义.

[1-2]

2、方案论证

2.1打铃时钟系统总体设计思路

按照系统设计功能要求,本系统由单片机控制读写时序.DS1302时钟芯片产生串行时间信号,背光灯时间, 闹铃时间永久存储在DS1302 RAM地址0xc1, 0xc3. 采用定时器中断实现秒表和倒计时.

2.2打铃时钟计时方案选择

方案1 单片机内部定时器计时实现时钟[3]

此方案外围电路简单,但内部时钟过多调用会引起时序冲突,增加系统运行的不稳定.并且软件编程复杂,程序运行的时间会严重影响定时精度.但是在时序确定的情况下,用定时器内部溢出中断定时可以达到时钟周期级精度. 方案2 DS1302 时钟芯片实现计时

DS1302是一款专用时钟芯片,可实现年月日星期时分秒计时,后备电源永不掉电,可实现时间记忆功能.定时精度到秒,硬件电路也简单.

方案3 HT1380时钟芯片实现计时

HT1380时钟芯片是一款专用时钟芯片,与DS1302引脚定义相似,功能相同.但是,价格较为昂贵,且容易因X1、X2引脚使

1

第1页

你可能喜欢

热门文档

相关文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email