学号 147308226
苏州市职业大学
毕业设计
题目基于AT89C51单片机的八路抢答器
的设计与实现
学生姓名:
专业班级:14通信技术2班 学院 (部):电子信息工程学院 校内指导教师:周燕(副教授) 校外指导教师:孙红荣(工程师)
完成日期: 2017年5月
摘要
抢答器作为一种很常见的电子类产品,实现方式有很多种,采取模拟电路和数字电路等方法,制作过程复杂繁琐,不易实现,并且稳定性不是很高。本抢答器设计采用51系列单片机为主要零件,与蜂鸣器和数码管等部件组成八路抢答器,利用单片机时钟电路、复位电路、按键电路等,设计出能显现抢答选手号码和抢答时间等特点,同时对单片机进行可在线编程实现其所设计的基本功能。在51系列单片机中采用比较常用的AT59C51作为本设计的单片机,性能稳定,制作简易。 在显示电路上我们采用四位七段共阴极数码管,来显示抢答者、抢答时间和答题时间。
关键字:抢答器、AT89C51、数码管、扬声器
I
Abstract
Now the rapid development of electronic technology, electronic products such as responder, often appear in various competitions, entertainment and other places. Responder as various competitions, entertainment and other activities to answer the answer players is a kind of electronic product, and is widely used. There are many kinds of methods to achieve Responder function, the analog circuit and digital circuit etc. the production process is complicated, and not easy to realize, and the stability is not very high. This design uses 51 microcontroller as the core component, and the buzzer and the digital tube and other components eight responder, the use of single-chip clock circuit, reset circuit, key circuit design, can show the player answer number and answer time features. Here we use AT59C51 as the microcontroller design, stable performance, simple manufacture.
Key words: responder, AT89C51, digital tube
II
目录
摘要 .............................................................................................. I Abstract ........................................................................................ II 目录 ............................................................................................. 1 1 绪论 ......................................................................................... 1
1.1设计背景及意义 ..................................................................................... 1 1.2本设计的主要内容 ................................................................................. 1
2 系统总体概述 .......................................................................... 2
2.1系统主要功能 ......................................................................................... 2 2.2 方案论证 .............................................................................................. 3 2.3 方案比较与选择 .................................................................................... 4
3硬件设计 ................................................................................... 4
3.1抢答器的工作原理 ................................................................................. 4 3.2主控芯片的介绍—AT89C51 ................................................................... 5 3.2.1单片机内部结构 .......................................................................... 5
3.2.2单片机的引脚定义 ...................................................................... 6 3.3功能电路的介绍 ..................................................................................... 7
3.3.1时钟频率电路的设计 .................................................................. 7 3.3.2复位电路的设计 .......................................................................... 7 3.3.3显示电路的设计 .......................................................................... 8 3.3.4键盘扫描电路的设计 .................................................................. 8 3.3.5报警电路的设计 .......................................................................... 9
4 软件设计 ................................................................................. 10
4.1主程序流程图 ....................................................................................... 10 4.2抢答流程图 ........................................................................................... 11 4.3子程序设计 ........................................................................................... 12
4.3.1定时中断子程序 ........................................................................ 12 4.3.2 外部中断子程序 ....................................................................... 13 4.3.3 报警子程序 ............................................................................... 14 4.3.4 控制子程序 ............................................................................... 15
5调试 ......................................................................................... 16
5.1硬件调试 ............................................................................................... 16 5.2软件调试 ............................................................................................... 17 5.3调试结果及分析 ................................................................................... 17
相关推荐: