《单片机电子时钟课程设计》由会员分享,可在线阅读,更多相关《单片机电子时钟课程设计(18页珍藏版)》请在金锄头文库上搜索。
1、 单片机技术课程设计说明书数字电子钟系 、 部: 电气与信息工程系 学生姓名: 全昌炽 指导教师: 王韧 职称 副教授专 业: 电子信息工程 班 级: 电子 0901 班 完成时间: 2011-12-22 摘 要时钟,自从它发明的那天起,就成为人类的朋友,但随着时间的推移,科学技术的不断发展,人们对时间计量的精度要求越来越高,应用越来越广。怎样让时钟更好的为人民服务,怎样让我们的老朋友焕发青春呢?这就要求人们不断设计出新型时钟。 数字电子钟的设计方法有多种,其中,利用单片机实现的电子钟具有编程灵活,便于电子钟功能的扩充,即可用该电子钟发出各种控制信号,精确度高等特点,同时可以用该电子钟发出各种
2、控制信号。本文主要介绍用单片机内部的定时/计数器来实现电子时钟的方法,本设计由单片机 AT89S52 芯片和 LED 数码管为核心,辅以必要的电路,构成了一个单片机电子时钟。与传统机械表相比,它具有走时精确,显示直观等特点。它的计时周期为 24 小时,显满刻度为“23 时 59 分 59 秒” ,另外具有校时功能等特点。该电子钟可以做到的功能:上电或按键复位后能自动显示系统提示符“P.”进入时钟准备状态。第一次按电子钟启动/暂停键,电子钟从 0 时 0 分 0 秒开始运行,进入时钟运行状态。再次按电子钟启动/暂停键,则电子钟进入时钟暂停状态,此时可按下调整键调整时间,分别通过时间加,时间减两个
3、按键调整时间。调整结束后可按启动/暂停键再次进入时钟运行状态。通过设置的 A、B、C、D 四个键来调整运行,并且利用了 8 位 LED 显示时分秒。此电子钟严格按照要求设计,最终达到预期的效果,能够正确显示“P”点以及时分秒的计时,算是一次比较成功的设计了。关键词:电子钟;单片机;汇编IABSTRACTClock, since it was invented that day, becomes the friend of mankind, but as time goes on, the continuous development of science and technology, peo
4、ple on the time measurement accuracy is higher and higher, more and more wide application. How to let the clock to better serve the people, how to make our old friend bloom? This requests the people to continue to design a new clock.The design of digital electronic clock methods are various, among t
5、hem, realize the use of single-chip electronic clock with programming flexibility, ease of electronic clock function expansion, can use the electric clock out of control signal, high accuracy, and can use the electric clock out of control signal.This paper mainly introduces the MCU internal timer /
6、counter to realize the electronic clock method, designed by the MCU and AT89S52 chip and LED digital tube as the core, supplemented by necessary circuit, composed of a single-chip electronic clock. Compared with the traditional mechanical watches, it has a precise path, intuitive display characteris
7、tics. Its time period is 24 hours, was in full scale as twenty-three fifty-nine 59 seconds, and a school function etc. The electronic clock can achieve the function of:Power on or reset button to automatically display the system prompt P. into clock ready state 2 for the first time by electronic clo
8、ck start / adjusting keys, electronic bell from 0 when 0 minute 0 seconds start running, enter the clock running state. Again by the electronic clock start / adjusting keys, electronic bell clock adjustment state is entered, this time by the adjusting button to adjust the time, after adjustment acco
9、rding to the start / adjusting key again into the clock running state. By setting the A, B, C, D four keys to adjust the operation, and the use of 8 bit LED is displayed every minute.The electronic clock in strict accordance with the requirements of the design, finally achieve the desired effect, ca
10、n correctly display P and of accurate timing, is a successful design.Key words: electronic clock; single-chip microcomputer; compilationII目 录1 电子钟功能及总体方案的介绍 .11.1 电子钟功能介绍 .11.1.1 基本功能要求 .11.2 总体方案介绍 .11.2.1 计时方案 .11.2.2 键盘/显示方案 .12 硬件系统设计 .32.1 硬件系统各模块功能介绍 .32.1.1显示电路 .32.1.2键盘控制电路 .32.1.3 电子钟的启、停及时间调整 .43 软件系统设计 .53.1 单片机的使用资源情况 .53.2 电子钟程序流程框图 .63.2.1 主程序流程框图 .63.2.2 键扫子程序流程框图 .73.2.3 中断服务程序流程框图 .83.2.4 显示子程序流程框图 .93.3 电子钟总体程序清单 .94 电子钟设计结论 .104.1 使用说明书 .