1、 目录 摘要1 ABSTRACT 2 1概述.3 1.1 本课题研究目的及意义 .3 1.2 国内外研究背景 .3 1.3 本课题的研究方法及预期达到的目的 .4 2 总体控制方案设计 5 2.1 数字时钟的工作原理 .5 2.2 单片机的选型 .5 2.3 AT89C51 单片机介绍.7 2.4 总体方案设计 .8 3 硬件设计9 3.1 键盘模块 .9 3.2 显示模块 .9 3.3 复位电路 .12 3.4 蜂鸣器驱动电路 .13 4 软件设计15 4.1 总体软件设计 .15 4.2 中断服务函数 .15 4.3 计时子函数 .16 4.4 闹钟子函数流程图 .17 4.5 键盘扫描子
2、函数 .18 4.6 时间和闹钟的设置 19 4.7 软件设计总结 20 5 总结 .21 6 参考文献22 7 致谢 23 附录24 1 摘要摘要 近年来,电子技术获得了飞速的发展,在其推动下,现代电子产品几乎渗透了社会的 各个领域, 有力地推动了社会生产力的发展和社会信息化程度的提高, 同时也使现代电子 产品性能进一步提高。 数字时钟是采用数字电路实现对“时” 、 “分” 、 “秒”数字显示的计时装置。数字钟的 精度、 稳定度远远超过老式机械钟。 在这次设计中, 我们采用 8 位 8 段 LED 数码管显示, 根据数码管动态显示原理来进行显示,用 12MHz 的晶振产生振荡脉冲,定时器计数
3、,并 采用外置喇叭作为响铃。在此次设计中,电路具有显示时间的其本功能,还可以实现对时 间的调整。数字时钟因外形小巧,价格低廉,走时精度高,使用方便,功能多,便于集成 化而受广大消费的喜爱,因此得到了广泛的使用。 关键字:单片机 数字时钟 2 ABSTRACT In recent years, electronic technology has gained rapid development, modern electronic products has been used in almost all spheres of society, Its a strong impetus to th
4、e development of social productivity and improvement in the level of social information. The performance of modern electronic products also has been further improved. The digital clock timing is a digital circuit which displays “hour“, “minute“, “second“. The accuracy, stability of digital clock is
5、far more than the old-fashioned mechanical clock. In this design, we use 8-segment LED digital display, and displayed according to digital dynamic display principle with a 12MHz crystal oscillator pulse and the timer count, and an external speaker is used as the ring. In this design, the circuit has
6、 the function to display time and the time can be adjusted. Because digital clock has the advantage of low prices, high precision, easy to use, multi-function, easy integration, it is loved by the majority of consumption, so it has been widely used. Keywords: single-chip machine digital clock 3 1 1概述概述 20 世纪末,电子技术获得了飞速的发展,在其推动下,现代电子产品几乎渗透了社会 的各个领域,有力地推动了社会生产力的发展和社会信息化程度的提高,同时也使现代电 子产品性能进一步提高,产品更新换代的节奏也越来越快。单片机的出现至今已经有 30 多年的历史了,单片机嵌入式技术也已历经了几个发展阶段。现在,以计算机和软件为核 心的数字化电子技术取得了迅猛发展,在其推动下,广泛渗