JIANGSU TEACHERS UNIVERSITY OF TECHNOLOGY
电子系统设计综合训练
多功能定时控制系统设计
学院名称: 电气信息工程学院 专 业: 电子信息工程 班 级: 09电2Z 姓 名: 施璐霞 学 号: 09311219 指导教师姓名: 刘晓杰、戴霞娟
2012年11月
第 1 页 共 50 页
电子系统设计报告
多功能定时控制系统设计
摘要:
电子钟主要是利用现代电子技术将时钟电子化、数字化。与传统的机械钟相比,具有时钟精确、显示直观、无机械传动装置等优点。
本设计是以单片机为核心,附加必要的外围电路,还用到时钟芯片DS1302和LCD1602的液晶显示器。在这些硬件基础上,通过编写配套的C语言程序,实现对年、月、日、时、分、秒在液晶屏上的显示,此外还实现整点报时和秒表计时功能。日期和时间通过相应的时钟芯片DS1302与单片机的配合工作将数据传送到液晶显示器上来实现的。整点报时和秒表计时的功能主要是通过软件和单片机的控制来实现的。因此我们要加上一些必要的按键,对相关数据进行设置于操作,如工作模式的选择,对年、月、日、时、分、秒的上、下调节,以及在秒表计时模式下有启动、清零、记录。
通过此次实物制作,增强了我们的动手能力,把理论与实践融合在一起。同时,也进一步加深了对单片机的硬件结构的理解和巩固,编程能力也得到了提高。在此将电子钟制作过程中用到的知识进行了一些总结,并记录了遇到的问题,希望自己今后能注意。同时也希望能成为读者的参考资料,能帮助读者避免出现相同的问题,并能从中得到一些启发。
关键词:电子钟 单片机 时钟芯片
Multi function timing control system design
第 2 页 共 50 页
电子系统设计报告
Abstract: Electronic clock is the use of modern electronic technology, digital
electronic clock. Compared with the traditional mechanical clock, with precision clock, visual display, no mechanical transmission device etc.
The design is based on the single-chip microcomputer as the core, the additional
necessary peripheral circuits, in addition to the single chip, also uses the clock chip DS1302 and LCD1602 liquid crystal display. On the basis of hardware, through the preparation of supporting C language program, realizes to the year, month, day, time, second in the LCD screen to display, in addition to realize the whole point timekeeping and stopwatch function of time. Date and time through the clock chip DS1302 and MCU work together to transmit data to the LCD display to achieve. The whole point timekeeping and stopwatch function mainly by software and single chip computer control to achieve. So we are going to add some necessary key, the relevant data for setting in operation, such as the selection of working mode, for the year, month, day, time, seconds, regulation, as well as in the stopwatch mode start, reset, recording.
Through the physical production, enhance our ability, put theory and practice together. At the same time, also further deepened to single-chip hardware structures to understand and consolidate, programming ability has been improved. The electronic clock making the knowledge used in the course of a number of summary, and recorded the encountered problems, hope that their future will pay attention. Also hope to become readers reference, can help readers to avoid the same problem, and can get some inspiration.
Keywords: Electronic clock Single-chip microcomputer the Clock Chip
第 3 页 共 50 页
电子系统设计报告
目 录
前言 ................................................................ 5
第1章绪论 ........................................ 错误!未定义书签。
1.1研究目的与意义 ............................. 错误!未定义书签。 1.2课题研究内容及技术指标 ..................... 错误!未定义书签。 第2章、系统的方案设计 ............................ 错误!未定义书签。
2.1系统方案设定与确定 ......................... 错误!未定义书签。 2.2系统实现总框图 ............................. 错误!未定义书签。 第3章、硬件电路设计 .............................. 错误!未定义书签。
3.1电源部分模块 ............................... 错误!未定义书签。 3.2主控模块 ................................... 错误!未定义书签。
3.2.1单片机的发展阶段 ..................................... 10 3.2.2 STC89C52单片机 ...................................... 11 3.2.3 主控模块的实现 ....................................... 13 3.3时钟产生电路 ............................................... 14
3.3.1 DS1302的简介 ........................................ 14 3.3.2 DS1302的结构及工作原理 .............. 错误!未定义书签。 3.3.3 DS1302实时显示时间软硬件 ............................ 15 3.3.4 DS1302的调试与电路实现 ............................. 16 3.4显示模块 ................................................... 16
3.4.1 LCD1602的简介 ....................................... 16 3.4.2 LCD1602引脚图及功能 ................................. 16 3.5按键控制模块 ............................................. -17
3.5.1键盘电路原理 ........................................ 17 3.5.2键盘电路与89C52的连接如图 ......................... 17 第 4 页 共 50 页
电子系统设计报告
第4章、软件设计 .................................. 错误!未定义书签。
4.1系统软件设计 ............................................... 18 4.2 模块软件设计 .............................................. 22
4.2.1 LCD1602的驱动程序 ................................... 22 4.2.2 DS1302的驱动程序 .................................... 25 4.2.3 整点报时的闹铃驱动程序 ............... 错误!未定义书签。 4.2.4 延时程序 ............................................. 30 第5章、测试结果 .................................. 错误!未定义书签。 第6章 总结与展望 ............................. -错误!未定义书签。1- 第7章、参考文献 .................................................. 31
第8章 附录 .................................................... 32
附录一:元器件清单 ............................................ 32 附录二:电路原理图 ........................................... 32 附录三:程序清单 .............................................. 33 附录四 实物图 .............................................. -50-
多功能定时控制系统设计
前言
随着时代的进步,科技日新月异的进步,现在的电子产品在社会上的各个领域发挥着不可替代的作用,单片机是电子元件中重要的一员,从1976年Intel公司推出的第一款8位单片机MCS-48开始,已经走过了30多年的历史。30多年中单片机迅速的更新换代,从最初的低性能迅速的过渡到如今的高性能阶段,并以其优异的性能和低廉的
第 5 页 共 50 页