
基于51单片机的四路抢答器设计-毕设论文.doc
37页山东农业大学 毕 业 论 文基于51单片机的四路抢答器设计院 部:机械与电子工程学院 专业班级:10级自动化1班 届 次:14届 学生姓名: 吴新春学 号:20101209 指导教师:刘平 二〇一四年五月二十七日摘要 IAbstract II引言 11系统概述 21.1抢答器需求分析 21.2 抢答器工作过程 22 单片机功能简介 32.1 STC89C51的功能 32.1.1 STC89C51特殊功能寄存器 32.2 STC89c51单片机的内部结构 53 系统硬件电路的设计 63.1 系统总电路如图 63.2 最小系统的设计 73.2.1 电源的设计 73.2.2 时钟频率电路的设计 73.2.3 复位电路的设计 93.3 显示电路的设计 113.3.1 数码管简介 123.3.2 CD4511七段译码器简介 133.4 按键电路的设计 153.5 蜂鸣器设计 153.6元器件焊接及调试 174 系统软件的设计 194.1 延时子程序 194.2 显示子程序 194.3 倒计时加按键扫描子程序 194.4主程序及分析 205 结论 23参考文献 24致谢 25附录 1 26附录2 27ContentsAbstract IIIntroduction 11 System overview 21.1 The analysis of responder needs 21.2 Responder work process 22 MCU features 32.1 STC89C51 32.1.1 Special function register 32.2 The internal structure of STC89c51 53 The design of circuit system 63.1 The circuit system 63.2 The design of minimum system 73.2.1 The design of power supply 73.2.2 The design of clock circuit 73.2.3 The design of reset circuit 93.3 The design of display circuit 113.3.1 Digital tube profile 123.3.2 The introduction of CD4511 133.4 The design of key circuit 153.5 The design of buzzer 153.6 Components and welding debugging 174 The design of software 194.1 Delay subroutine 194.2 Display program 194.3 The countdown and keyboard scanning subroutine 19 4.4 Main program and analysis 205 Conclusions 23References 24Acknowledgement 25Appendix 1 26Appendix 2 27ii基于51单片机的四路抢答器设计作者:吴新春,指导教师:刘平(山东农业大学 讲师)【摘要】本文设计以STC89C51单片机为核心的四路抢答器。
采用了数字显示器直接显示,自动锁存显示结果,并自动复位的设计思想,它能根据不同的抢答输入信号,经过单片机的控制处理产生不同的与输入信号相对应的输出信号,最后通过LED数码管显示相应的路数,分辨出是哪组优先按下的按键,它充分利用了单片机系统的优点,具有结构简单、功能强大、可靠性好、实用性强的特点本设计是以四路抢答为基本理念考虑到需限时回答的功能,利用89C51单片机及外围接口实现的抢答系统,利用单片机的定时器/计数器定时和记数的原理,将软、硬件有机地结合起来,使得系统能够正确地进行计时,同时使数码管能够正确地显示时间同时系统能够实现:在抢答中,只有开始后抢答才有效;满时后系统等待主控强制复位;按键锁定等功能关键词 :51单片机 四路抢答器 数码管 最小系统The design of Quad Responder based on 51 microcomputer Author: Wu Xinchun, Supervisor: LiuPing( Shandong Agricultural University Lecturer )Abstract This paper design the STC89C51 microcontroller as the core of the four road responder. Adopting digital display directly display, automatic latch display results, and the idea of the design of the automatic reset which can according to different vies to answer first the input signal, through MCU control processing in different ways with the input signals corresponding to the output signal, finally, LED digital tube display the corresponding, distinguish is which group first press the button, it makes full use of the advantages of the MCU system whih is simple in structure, the characteristics of powerful function, good reliability and strong practicability.This design is based on four road vies to answer first the basic concepts. Considering the function need time to answer, the use of 89C51 MCU and peripheral interface implementation of vies to answer first system, the MCU’s timer/counter timing and the number of principle, software and hardware organically, enables the system to accurately time, at the same time make digital tube can correctly display the time. At the same time, system can realize: in vies to answer first, only after the start of vies to answer first effectively; After full waiting for forced reset control system; Key lock, and other functions.Key words: 51 single chip microcomputer; four-way buzzer; digital tube minimum system i引言随着科学技术的飞速发展和生活内容的丰富,各种各样的竞赛越来越多,其中抢答器有着无可替代的作用。
目前很多抢答器采用小规模数字集成电路设计,使用起来不够理想因此设计一种更便于使用的抢答器是非常必要的随着科技的进步单片机已进入各个领域,以其功耗小、智能化而著称,所以利用单片机来设计抢答器,便可以解决上述问题针对以上情况,本文设计出以STC89C51单片机为核心的四路抢答器我们采用了数码管显示,自动锁存显示结果,并自动复位的设计思想,它能根据不同的抢答输入信号,经过单片机的控制处理并产生不同的与输入信号相对应的输出信号,最后通过LED数码管显示相应的路数,可分辨出优先按下的按键,它充分利用了单片机系统的优点,具有结构简单、功能强大、可靠性好、实用性强的特点考虑到需设定限时回答的功能,利用89C51单片机及外围接口实现的抢答系统,利用单片机的定时器/计数器定时和记数的原理,将软、硬件有机地结合起来,使得系统能够正确地进行计时,同时使数码管能够正确地显示时间用开关做键盘输出同时系统能够实现:主控操作优先;在抢答中,只有开始后抢答才有效,如果在开始抢答前抢答为无效;满时后系统等待主控强制复位;按键锁定,在有效状态下,按键无效非法1系统概述1.1抢答器需求分析(1) 在抢答中,只有开始后抢答才有效,如果在开始抢答前抢答为无效。
2) 抢答限定时间20秒和回答问题的时间60秒3) 可以显示是哪位选手有效抢答和无效抢答,正确按键后显示按键者号码并锁存直到主持人允许答题4) 抢答时间和回答问题时间倒记时显示,时间完后等待主持人按键复位5) 按键锁定,在有效状态下,按键无效非法1.2 抢答器工作过程主持人按“抢答开始”键,立刻进入抢答倒计时(预设20s抢答时间),如有选手抢答,显示其号数并等待主持人允许答题,允许答题(主持人按键)进入答题倒计时(预设60秒答题时间)不进行抢答查询,所以只有第一个按抢答的选手有效 如倒计时期间,主持人想停止倒计时可以随时按“停止”按键,系统会自动进入准备状态,等待主持人按“抢答开始”进入下次抢答计时如果主持人未按“答开始”,而有人按了抢答按键,犯规抢答,LED上不显示任何结果,直到按下“止”键为止系统方框图如图1-1所示 图1-1系统方框图2 单片机功能简介MCS-51 单片机是美国INTE 公司于1980 年推出的产品,典型产品有 80 31(内部没有程序存储器,实际使用方面已经被市场淘汰)、8051(芯片采用HMOS,功耗是630mW,是89C51 的5 倍,实际使用方面已经被市场淘汰)和8751 等通用产品,一直到现在, MCS-5 1 内核系列兼容的单片机仍是应用的主流产品(比如目前流行的89S51、已经停产的89C51 等),各高校及专业学校的培训教材仍与MCS-51 单片机作为代表进行理论基础学习。
有些文献甚至也将8051 泛指MCS-51 系列单片机,8051 是早期的最典型的代表作,由于MCS-51 单片机影响极深远,许多公司都推出了兼容系列单片机,就是说MCS-51 内核实际上已经成。