1、EDA课程设计抢答器可编辑修改word版内容摘要抢答器是为智力竞赛参赛者答题时进行抢答而设计的一种优先判决器电路,竞赛者可以分为若干组,抢答时各组对主持人提出的问题要在最短的时间内做出判断,并按下抢答按键回答问题。当第一个人按下按键后,则在显示器上显示该组的号码,对应的灯亮,同时电路将其他各组按键封锁,使其不起作用。若抢答时间内无人抢答,则报警灯亮。回答完问题后,由主持人将所有按键恢复,重新开始下一轮抢答。因此要完成抢答器的逻辑功能,该电路应包括抢答器鉴别模块、抢答器计数模块、报警模块、译码模块、分频模块。关键词:抢答鉴别 封锁 计数 报警AbstractResponder is the an
2、swer for the quiz participants to answer in the design when a priority decision circuit, and the race can be divided into several groups, answer in each group on the host issues raised in the shortest possible time to make judgments , and press the answer in answer key. After pressing the button whe
3、n the first person, then the display shows the number of the group, the corresponding lights, while other groups will be key circuit block, it does not work. If the answer in time, no answer in, the alarm lights. Answering questions, all the keys from the host to restore and re-start the next round
4、of the Responder. So to complete the answering device logic functions, the circuit should include Responder identification module, Responder counting module, alarm module, decoding module, frequency module.KEY: Responder Identification Blockade Count Alarm一、 设计要求1.抢答器同时供 4 名选手或 4 个代表队比赛,分别用 4 个按钮 S0
5、 S3 表示。2.设置一个系统清除和抢答控制开关 rst,该开关由主持人控制。3.抢答器具有锁存与显示功能。即选手按动按钮,锁存相应的编号,并在 LED 和数码管上显示,同时提示灯亮。选手抢答实行优先锁存,优先抢答选手的编号一直保持到主持人将系统清除为止。4.抢答器具有定时抢答功能,且一次抢答的时间由主持人设定(如 20 秒)5.如果定时时间已到,无人抢答,本次抢答无效,系统报警并禁止抢答,定时显示器上显示 20。二、方案设计与论证1、 概述将该任务分成五个模块进行设计,分别为:抢答器鉴别模块、抢答器计时模块、报警模块、分频模块、译码模块。2、 抢答器鉴别模块:在这个模块中主要实现抢答过程中的
6、抢答功能,并能对超前抢答进行警告,还能记录无论是正常抢答还是朝前抢答者的台号,并且能实现当有一路抢答按键按下时, 该路抢答信号将其余的抢答信号封锁的功能。其中有四个抢答信号 s0、s1、s2、s3; 抢答状态显示信号 states;抢答与警报时钟信号 clk2;系统复位信号 rst;警报信号warm。3、 抢答器计数模块:在这个模块中主要实现抢答过程中的计时功能,在有抢答开始后进行 20 秒的倒计时,并且在 20 秒倒计时后无人抢答显示超时并报警。其中有抢答时钟信号 clk1;系统复位信号 rst;抢答使能信号 start;无人抢答警报信号 warn;计时中止信号 stop; 计时十位和个位信
7、号 tb,ta。4、 报警模块:在这个模块中主要实现抢答过程中的报警功能,当主持人按下控制键,有限时间内人抢答或是计数到时蜂鸣器开始报警,计数停止信号 stop;状态输出信号 alm;计数脉冲 clk。5、 译码模块:在这个模块中主要实现抢答过程中将 BCD 码转换成 7 段的功能。6、 分频模块:在这个模块中主要实现抢答过程中所需的时钟信号。7、 顶层文件:在这个模块中是对前五个模块的综合编写的顶层文件。三、单元电路设计(一)抢答鉴别模块1.VHDL 源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned
8、.all; entity xuanshou is port(rst,clk2:in std_logic;s0,s1,s2,s3:in std_logic;states:buffer std_logic_vector(3 downto 0); light:buffer std_logic_vector(3 downto 0); warm:out std_logic);end xuanshou ;architecture one of xuanshou is signal st:std_logic_vector(3 downto 0); beginp1:process(s0,rst,s1,s2,s
9、3,clk2) beginif rst=0 then warm=0;st=0000;elsif clk2event and clk2=1 thenif (s0=1 or st(0)=1)and not( st(1)=1 or st(2)=1 or st(3)=1 ) then st(0)=1;end if ;if (s1=1 or st(1)=1)and not( st(0)=1 or st(2)=1 or st(3)=1 ) then st(1)=1;end if ;if (s2=1 or st(2)=1)and not( st(0)=1 or st(1)=1 or st(3)=1 ) th
10、en st(2)=1;end if ;if (s3=1 or st(3)=1)and not( st(0)=1 or st(1)=1 or st(2)=1 ) then st(3)=1;end if ;warm=st(0) or st(1) or st(2) or st(3); end if ;end process p1; p2:process(states(0),states(1),states(2),states(3),light) beginif (st=0000) then states=0000; elsif (st=0001) then states=0001; elsif (s
11、t=0010) then states=0010; elsif (st=0100) then states=0011;elsif (st=1000) then states=0100; end if;light=st;end process p2; end one;2.抢答鉴别仿真图3.抢答鉴别元件图(二)计数模块1.VHDL 源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all; entity JS isport(clk1,rst,start,stop:in std_logic; ta,tb:b
12、uffer std_logic_vector(3 downto 0);end JS;architecture one of JS is signal co:std_logic; beginp1:process(clk1,rst,start,stop,ta) beginif rst=0 or stop=1 then ta=0000;elsif clk1event and clk1=1 thenco=0;if start=1 thenif ta=0000 then ta=1001;co=1;else ta=ta-1; end if;end if; end if;end process p1; p2
13、:process(co,rst,start,stop,tb)beginif rst=0 or stop=1 then tb=0010;elsif coevent and co=1 then if start=1 thenif tb=0000 then tb=0011; else tb=tb-1;end if; end if;end if; end process p2; end one ;2.计数仿真图3.计数元件图(三)报警模块1.VHDL 源程序library ieee;use ieee.std_logic_1164.all; entity shengyin is port(rst:in
14、std_logic;warn:in std_logic; clk:in std_logic;ta,tb:in integer range 0 to 9; stop:in std_logic;alm:out std_logic ); end;architecture bhv of shengyin is begin process(warn,ta,tb,stop,clk) beginif rst=0then alm=0;elsif stop=1then alm=0;elsif ta=0 and tb=0 then alm=clk;elsif warn=1then alm=clk;else alm
15、doutdoutdoutdoutdoutdoutdoutdoutdoutdoutdout=1111111;END CASE;END PROCESS;END rtl;2.译码元件图(五)分频模块(用 500HZ 的时钟和 1HZ 的计数时钟)1Div100library ieee;use ieee.std_logic_1164.all; entity div100 isport(clk:in std_logic; clk100:out std_logic);end div100;architecture art of div100 is signal num: integer range 0 t
16、o 99; signal temp:std_logic;begin process(clk) beginif clkevent and clk=1then if num=99 then num=0;temp=not temp;else num=num+1; end if; clk100=temp; end if;end process; end art;仿真图:Div100元件图:2.DIV50M:这是一个50M分频,将50MHZ的信号分为1HZ。LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL;USE
17、 IEEE.STD_LOGIC_UNSIGNED.ALL;ENTITY fenpin IS PORT(clk : IN STD_LOGIC; clk50 : OUT STD_LOGIC);END fenpin;ARCHITECTURE rtl OF fenpin ISSIGNAL count : STD_LOGIC_VECTOR(25 DOWNTO 0); BEGINPROCESS(clk) BEGINIF (clkevent AND clk=1) THEN IF(count=10111110101111000010000000) THEN Count =0000000000000000000
18、0000000;ELSECount = count +1; END IF ;END IF ;END PROCESS; PROCESS(clk) BEGINIF (clkevent AND clk=1) THENIF(count=10111110101111000010000000) THEN clk50 = 1;ELSEclk50 = 0; END IF ;END IF ;END PROCESS;END;fenpin元件图(六)顶层文件1.仿真图:2.QDQ_1 主电路图连线四 锁定引脚及下载1.选择锁定引脚,再重新编译一次。在编程窗的 Mode 中选择 Active Serial progr
19、amming 编程模式,打开编程文件,选中 QDQ.pof,并选中打钩前 3 个编程项目,在 ED2 板上选择 PROG 模式,然后下载。2.锁定引脚:时钟信号 clk N2发光二极管 LEDRO-LEDR3(AE23.AF23.AB21.AC22)数 码 管 num0-num6 (AB12.AC12.AD11.AE11.V14.V13) ta0-ta6 (AB23.V22.AC25.AC26.AB26.AB25.Y24) tb0-tb6 (Y23.AA25.AA26.Y26.Y25.U22.W24)开关 rst AF14SW0-SW3(N25.N26.P25.AE14) SOUND AA14START AD13 STOP AC13
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1