《单片机原理及应用》
课程设计报告
课题名称 学院 专业 班级 学号 姓名 时间 指导教师
多通道百分秒表设计
2016年月
目录
一、内容提要 ..................................... 5
1.设计任务 ........................................... 5 2设计要求: .......................................... 5 3设计提示: .......................................... 5
二、步骤及方案 ................................... 5 三、硬件设计 ..................................... 6
1、单片机的选择与外围电路 ............................. 6 2.单片机与显示模块电路 ................................ 7 3.键盘电路 ........................................... 8 4.显示LED电路 ....................................... 9 5.外围小灯电路 ...................................... 10 6.整体电路protuus仿真图 ............................. 11
四、软件设计 .................................... 12
1.系统主函数程序 .................................... 12 2.初始化函数程序 .................................... 12 3、显示函数程序 ..................................... 13 4.开关函数程序 ...................................... 14 5.中断函数程序 ...................................... 15
五、调试 ........................................ 16 六、课程设计心得体会 ............................ 17 参考文献 ........................................ 18
2
附录:源程序代码 ................................ 18
3
基于单片机的多通道百分秒表设计
摘要:
近年来随着科技的飞速发展,单片机的运用正在不断的走向深入,同时带动传统控制检测日新月异的更新。本秒表设计采用8051单片机为中心器件,利用其定时/计数器定时、计数的原理,结合显示电路、按键控制电路等外围电路来完成。将软、硬件有机的结合起来,使得系统能够实现4位LED显示,显示时间为00.00到99.99秒,每秒自动加一,可以用开关控制开始、停止、复位,并且能拥有多通道(两个或以上)分别计时功能。其软件系统采用C语言编写程序,包括:显示程序、中断初始化程序、中断服务程序、显示程序及开关控制程序。通过KEIL4与PROTEUS进行联合调试,使得硬件与软件有机的结合起来,达到了预期目的。
关键词:单片机,秒表,多通道
Abstract:
In recent years along with the rapid development of science and technology, the single-chip microcomputer application is constantly deepening, led the traditional control test at the same time change rapidly update. The stopwatch design using 8051 single chip as a core device, using the timer / counter timing, counting principles, combined with display circuit, control circuit and other peripheral circuit to complete. The soft, hardware of organic combination, so that the system can achieve 4 LED display, display time is 0 to 99.99 seconds, plus a second automatic, can use the switch to control start, stop, reset, and can have multiple channels ( two or more ) are functions of time. The system software using C language programming, including: display program, interrupt initialization, interrupt service routines, display and switch control procedures. Through the KEIL4 and PROTEUS joint debugging, which makes hardware and software combined with organic, to achieve the expected goal.
Key words: Single Chip Microcomputer; Stopwatch; Multi Channel
4
一、内容提要
1.设计任务
基于AT89C51设计一个5位LED数码作为“多通道百分秒表”。
2设计要求:
(1)、显示时间为00.00—99.99秒,每百分之秒自动加1。 (2)、设计一个有三个按键的键盘。K1:“开始”→“停止”→“复位”→“开始”??。K2:显示通道数“加一”。K3:显示通道数“减一”。
(3)、@ 设计每到一秒钟有声音或LED指示提醒功能,可通过按钮打开及关闭该提醒功能。
(4)、☆其他功能。D2、D3小灯按照01、02通道分别计时时间到10秒时熄灭。(定时:到某一时间有LED提醒功能)。
3设计提示:
(1)、用6位个7段LED数码管作为显示设备,最高位显示通道号,低4位显示时间。
(2)、可采用定时器,定时时间10ms。 (3)、参考Protuse仿真效果图:
二、步骤及方案
根据系统的设计要求,选择AT89C51单片机作为系统的核心来完成定时、计数的功能,用74HC245来完成数据的锁存和对LED的刷新控制,用外围开关电路实现对单片机的外围输入,用小灯来实现对于计时等功能的提示。
5