1、 单片机课程设计 项目名称 基于单片机的秒表设计 专业班级 学生姓名 指导教师 2012 年 11 月 20 日 I 摘 要 本课程设计的数字电子秒表系统采用 AT89C51 单片机为中心器件,利用其定时器/ 计数器定时和记数的原理, 结合显示电路、 LED 数码管以及外部中断电路来设计计时器。 将软、硬件有机地结合起来,使得系统能够实现五位 LED 显示,显示时间为 099.99 秒,计时精度为 0.01 秒,能精确地进行计时,并可以随时暂停和开始。软件系统采用 C 语言编写,包括显示程序,定时中断服务,外部中断服务程序,延时程序等,硬件系 统利用 PROTEUS 强大的功能来实现,简单且易
2、于观察,在仿真中就可以观察到系统实际 的工作状态。 关键词关键词:AT89C51 单片机 ;数字秒表 ;数码管 II Abstract This course is designed digital electronic stopwatch system uses the AT89C51 microcontroller devices, the use of timer / counter timing and counting principle, combined with the display circuit LED digital tube as well as the extern
3、al interrupt circuit designed timer. The hardware and software combine to enable the system to achieve five LED display, the display time of 99.99 seconds, the timing accuracy of 0.01 seconds, the correct timing, and the right to suspend and start. Software system using C language, including the dis
4、play program, the timer interrupt service external interrupt service routine, delay procedures, hardware system to implement the use of the PROTEUS powerful functionality, simple cut easily observed in the simulation to the actual work can be observed status. Keywords: AT89C51 Microcontroller; Digit
5、al stopwatch; Digital tubes III 目 录 摘 要.I Abstract . II 第 1 章 绪论 1 1.1 概述. 1 1.2 定时器术的研究现状. 1 1.2.1 定时器的应用 1 1.2.2 定时器定时软件 2 1.3 本文研究的意义. 2 第 2 章 系统总体设计 3 2.1 总体方案的设计. 3 2.2 系统总电路的设计. 3 第 3 章 系统硬件设计 5 3.1 单片机的选择. 5 3.2 显示电路的选择与设计. 6 3.3 复位电路模块. 8 3.4 系统总体设计. 8 第 4 章 系统的软件设计 10 第 5 章 实物焊接、仿真与调试 12 5.
6、1 软件的仿真与调试. 12 5.2 硬件的安装与调试. 13 第 6 章 结论 14 致谢 15 参考文献 16 附录 1. 17 源程序代码 17 附录 2. 20 软件仿真截图 20 附录 3. 21 实物照片展示 21 1 第 1 章 绪论 1.1 概述 人类最早使用的定时工具是沙漏或水漏,但在钟表诞生发展成熟之后,人们开始尝 试使用这种全新的计时工具来改进定时器,达到准确控制时间的目的。 1876 年,英国外科医生索加取得一项定时装置的专利,用来控制煤气街灯的开关。 它利用机械钟带动开关来控制煤气阀门。起初每周上一次发条,1918 年使用电钟计时 后,就不用上发条了。定时器确实是一项了不起的发明,使相当多需要人控制时间的工 作变得简单了许多。人们甚至将定时器用在了军事方面,制成了定时炸弹,定时雷管。 现在的不少家用电器都安装了定时器来控制开关或工作时间。 秒表计时器是电器制造,工业自动化控制、国防、实验室及科研单位理想的计时仪 器,它广泛应用于各种继电器、