实习(设计)报告
姓 名:王星辰 班 级:10电81 学 号:10288004 实习(设计)科目:单片机 实习(设计)地点:12#405A
实习(设计)时间:2013.01.07——2013.01.22
电气工程及自动化学院
School of Electrical Engineering & Automation
基于单片机数字时钟的设计
摘要:
本文介绍了简单数字时钟的系统设计。系统具有时间设置及显示功能,时间为24小时制,也可以自由编写程序进行改写为12小时制。系统以STC89C52为核心,主要进行基于STC89C52简单数字时钟及其系统的研究,为初学者学习的典型例子。系统带有数码管显示,该数码管显示由两片四位数码管构成,配合按键提供的简单操作,可以进行调时、设置时间。系统软件设计包括单片机编程。单片机软件编程主要实现按键、数码管显示、时间处理、按键处理等模块功能。
关键词:数字时钟、单片机、74HC573、73HC138、共阴数码管
1
目录
1、引言···························································3
1.1课程设计要求·················································4 1.2课程设计目的·················································4
2、单片机发展历史···············································5
2.1三大阶段······················································5
2.2单片机发展趋势················································6
3、单片机的应用··················································8
3.1单片机的应用分类··············································8
4、数字时钟的构成················································9
4.1数字时钟的构成················································9
4.2方案选择与相关技术············································9 4.3 STC89C52·····················································9 4.4 74HC573·····················································15 4.4 74HC138·····················································16 4.5 LED模块的原理及应用········································17
5、电路设计·····················································18
5.1 Proteus仿真··················································18
5.2系统软件设计·················································18 5.3系统硬件设计·················································18 5.4成品图片·····················································19 5.4 编程思路····················································20
总结······························································21 参考文献·························································22 附录······························································23 致谢······························································31
2
1、引言
在日新月异的
21世纪里,家用电子产品得到了迅速发展。许多家电设备都趋于
人性化、智能化,这些电器设备大部分都含有CPU控制器或者是单片机。单片机以其高可靠性、高性价比、低电压、低功耗等一系列优点,近几年得到迅猛发展和大范围推广,广泛应用于工业控制系统、通讯设备、日常消费类产品和玩具等。并且已经深入到工业生产的各个环节以及人民生活的各个方面,如车间流水线控制、自动化系统等、智能型家用电器(冰箱、空调、彩电)等。用单片机来控制的小型家电产品具有便携实用,操作简单的特点。
时钟,自从它发明的那天起,就成为人类的朋友,但随着时间的推移,科学技术的不断发展,人们对时间计量的精度要求越来越高,应用越来越广。怎样让时钟更好的为人民服务,怎样让我们的老朋友焕发青春呢?这就要求人们不断设计出新型时钟。
现今,高精度的计时工具大多数都使用了石英晶体振荡器,由于电子钟,石英表,石英钟都采用了石英技术,因此走时精度高,稳定性好,使用方便,不需要经常调校,数字式电子钟用集成电路计时时,译码代替机械式传动,用LED显示器代替显示器代替指针显示进而显示时间,减小了计时误差,这种表具有时,分,秒显示时间的功能,还可以进行时和分的校对,片选的灵活性好。
时钟电路在计算机系统中起着非常重要的作用,是保证系统正常工作的基础。在一个单片机应用系统中,时钟有两方面的含义:一是指为保障系统正常工作的基准振荡定时信号,主要由晶振和外围电路组成,晶振频率的大小决定了单片机系统工作的快慢;二是指系统的标准定时时钟,即定时时间,它通常有两种实现方法:一是用软件实现,即用单片机内部的可编程定时/计数器来实现,但误差很大,主要用在对时间精度要求不高的场合;二是用专门的时钟芯片实现,在对时间精度要求很高的情况下,通常采用这种方法,典型的时钟芯片有:DS1302,DS12887,X1203等都可以满足高精度的要求。
本文设计的数字时钟的显示广泛用于小型智能家用电子产品,如电子钟。利用单片机进行控制,可实现时间的调整和显示。电子钟既可广泛应用于家庭,也可应用于银行、邮电、宾馆、医院、学校、企业、商店等相关行业的大厅,以及单位会议室、门卫等场所。因而,此设计具有相当重要的现实意义和实用价值。
3
1.1课程设计要求
本次课程设计为个人制定的,初次实习单片机,所以可以实现的功能比较简单 功能要求:
1、 能显示时、分、秒 2、 能够手动校正时间 3、 采用24小时制
4、 使用LED显示时间参数
5、 上电之后显示时间“8时8分8秒”
1.2课程设计目的
(1)巩固、加深和扩大单片机应用的知识面,提高综合及灵活运用所学知识解决工业控制的能力
(2)培养针对课题需要,选择和查阅有关手册、图标及文献资料的自学能力,提高组成系统、编程、调试的动手能力
(3)通过对课题设计方案的分析、选择、比较、熟悉单片机应用系统开发、研制的过程,软硬件设计的方法、内容和步骤
4