ImageVerifierCode 换一换
格式:DOCX , 页数:25 ,大小:747.22KB ,
资源ID:7410199      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/7410199.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(四路抢答器VDHL实验报告含程序.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

四路抢答器VDHL实验报告含程序.docx

1、四路抢答器VDHL实验报告含程序电子学课程设计实验报告 四路抢答器设计与制作 Rong 目录第1章 设计的性质、目的和任务2第2章 设计课题要求3第3章 设计的内容、电路原理和详细的设计过程4第4章 调试与仿真结果20第5章 调试中遇到的问题及解决的方法22第6章 体会、感想、建议23附录1 参考文献24第一章 设计的性质、目的和任务创新精神和实践能力二者之中,实践能力是基础和根本。这是由于创新基于实践、源于实践,实践出真知,实践检验真理。实践活动是创新的源泉,也是人才成长的必由之路。通过课程设计的锻炼,要求学生掌握电路的一般设计方法,具备初步的独立设计能力,提高综合运用所学的理论知识独立分析

2、和解决问题的能力,培养学生的创新精神。第二章 设计课题要求四路抢答器设计与制作设计要求:设计一个四路抢答器。抢答器必须具有互锁功能,同时抢答时每次只能有一个输出有效。同时,抢答时具有计时功能,限定选手的答题时间,在接近规定时间时进行提示,达到规定时间发出终止音。主持人可控制加分或减分。见简略示意图。第三章 设计的内容、电路原理和详细的设计过程3.1设计内容 3.1.1流程图 YES NO YES NO YES NO 图1 流程图3.1.2 设计思路 自顶向下,顶层采用原理图设计,以下各层次采取VHDL描述语言实现。顶层用原理图简单,方便。模块用VHDL,可读性好,移植性好,入档、交流、交付方便

3、。模块须分为以下模块:抢答鉴别电路,计时器,记分器,分频器,扫描显示,译码器,蜂鸣器。3.2 电路原理图2 四路抢答器的组成3.3详细的设计过程3.3.1 顶层设计按图2设计。如果模块需要增减再进行修改。3.3.2 抢答鉴别电路设计I输入/输出:4个按键抢答输入:a,b,c,d;4个接LED的输出a1,b1,c1,d1;1组给记分器的片选输出states3.0。II功能:先输入a时,a1输出,b,c,d不能输入;先输入b时,b1输出,a,c,d不能输入;先输入c时,c1输出,a,b,d不能输入;先输入d时,d1输出,a,b,c不能输入;片选给记分器选择结果。IIIVHDL程序:library

4、ieee; use ieee.std_logic_1164.all;entity qdjb is port(a,b,c,d:in std_logic; a1,b1,c1,d1:out std_logic; states:out std_logic_vector(3 downto 0);end entity qdjb;architecture art of qdjb isconstant w1: std_logic_vector:=0001;constant w2: std_logic_vector:=0010;constant w3: std_logic_vector:=0100;consta

5、nt w4: std_logic_vector:=1000;beginprocess(a,b,c,d)is begin if (a=1and b=1and c=1and d=1) then a1=0;b1=0;c1=0;d1=0;states=0000; elsif (a=0and b=1and c=1and d=1) then a1=1;b1=0;c1=0;d1=0;states=w1; elsif(a=1and b=0and c=1and d=1)then a1=0;b1=1;c1=0;d1=0;states=w2; elsif(a=1and b=1and c=0and d=1)then

6、a1=0;b1=0;c1=1;d1=0;states=w3; elsif(a=1and b=1and c=1and d=0)then a1=0;b1=0;c1=0;d1=1;states=w4; end if; end process;end architecture art;IV模块图形:图3 抢答鉴别电路3.3.3 计时器设计I输入/输出:1个时钟信号输入1个复位信号输入2组4位2进制信号输出作为显示计时信号。II功能:通过1Hz的时钟进行20秒倒计时,至00停止直至复位信号给入,恢复20。IIIVHDL程序:library ieee; use ieee.std_logic_1164.al

7、l;use ieee.std_logic_unsigned.all;entity jsq is port(clk,clr:in std_logic; qa:out std_logic_vector(3 downto 0); qb:out std_logic_vector(3 downto 0);end entity jsq;architecture art of jsq isbeginprocess(clk,clr) is variable tmpa:std_logic_vector(3 downto 0); variable tmpb:std_logic_vector(3 downto 0)

8、; begin if clr=0then tmpa:=0000;tmpb:=0010; elsif clkevent and clk=1 then if tmpa=0000and tmpb=0000then tmpa:=0000; tmpb:=0000; elsif tmpa=0000then tmpa:=1001; if tmpb=0000 then tmpb:=0010; else tmpb:=tmpb-1; end if; else tmpa:=tmpa-1; end if; end if; qa=tmpa;qb=tmpb;end process;end architecture art

9、;IV模块图形:图4 计时器3.3.4 记分器设计I输入/输出:1个时钟信号输入;1个复位信号输入;1组片选信号输入;4组4位2进制输出作为分数信号;II功能:在时钟上升沿,依照片选信号,通过add(min)信号进行加(减)1分操作。结果分别通过aa1,bb1,cc1,dd1反映。IIIVHDL程序:-jifenqilibrary ieee; use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity jfq is port(rst:in std_logic; clk:in std_logic; add:in std_l

10、ogic; min:in std_logic; chos:in std_logic_vector(3 downto 0); aa1,bb1:out std_logic_vector(3 downto 0); cc1,dd1:out std_logic_vector(3 downto 0);end entity jfq;architecture art of jfq is begin process(rst,add,min,chos) is variable points_a1:std_logic_vector(3 downto 0); variable points_b1:std_logic_

11、vector(3 downto 0); variable points_c1:std_logic_vector(3 downto 0); variable points_d1:std_logic_vector(3 downto 0); begin if(clkevent and clk=0)then if rst=0 then points_a1:=0000; points_b1:=0000; points_c1:=0000; points_d1:=0000; end if; if add=0then if chos=0001then if points_a1=1001then points_

12、a1:=0000; else points_a1:=points_a1+1; end if; elsif chos=0010then if points_b1=1001then points_b1:=0000; else points_b1:=points_b1+1; end if; elsif chos=0100then if points_c1=1001then points_c1:=0000; else points_c1:=points_c1+1; end if; elsif chos=1000then if points_d1=1001then points_d1:=0000; el

13、se points_d1:=points_d1+1; end if; end if; elsif min=0then if chos=0001then if points_a1=0000then points_a1:=1001; else points_a1:=points_a1-1; end if; elsif chos=0010then if points_b1=0000then points_b1:=1001; else points_b1:=points_b1-1; end if; elsif chos=0100then if points_c1=0000then points_c1:

14、=1001; else points_c1:=points_c1-1; end if; elsif chos=1000then if points_d1=0000then points_d1:=1001; else points_d1:=points_d1-1; end if; end if; end if; end if; aa1=points_a1; bb1=points_b1; cc1=points_c1; dd1=points_d1; end process;end architecture art;IV模块图形:图5 记分器3.3.5分频器设计I输入/输出:1个50MHz时钟信号输入

15、;1个1Hz时钟信号输出;1个1KHz时钟信号输出;1个2KHz时钟信号输出。II功能:将50MHz时钟分频为1Hz,1KHz,2KHz分别输出。IIIVHDL程序:library ieee;use ieee.std_logic_1164.all;entity fp isport(clk : in std_logic;clk1hz,clk1khz,clk2khz:out std_logic);end fp;architecture beh of fp issignal data1khz,data1hz,data2khz : std_logic := 0;begin clk1hz = data1

16、hz; clk1khz = data1khz; clk2khz = data2khz; clk1khz_pro : process(clk) -1khz variable cnt : integer range 0 to 24999; begin if clkevent and clk=1 then if cnt = 24999 then cnt := 0 ; data1khz = not data1khz; else cnt := cnt + 1; end if; end if; end process clk1khz_pro; clk1hz_pro : process(data1khz)

17、-1hz variable cnt : integer range 0 to 499; begin if data1khzevent and data1khz=1 then if cnt = 499 then cnt := 0 ;data1hz = not data1hz ; else cnt := cnt + 1; end if; end if; end process clk1hz_pro; clk2khz_pro : process(clk) -2khz variable cnt : integer range 0 to 12499; begin if clkevent and clk=

18、1 then if cnt = 12499 then cnt := 0 ; data2khz = not data2khz; else cnt := cnt + 1; end if; end if; end process clk2khz_pro; end beh;IV模块图形:图6 分频器3.3.6扫描显示设计I输入/输出:1个时钟信号输入;6组4位2进制信号输入;1组位选信号输出;1组4位2进制信号输出。II功能:通过比人眼识别力频率高的时钟信号,将6组信号在6位上扫描输出,2位固定输出。IIIVHDL程序:library ieee;use ieee.std_logic_1164.all;

19、entity scan isport(clk1khz : in std_logic;fsd,fsc,fsb,fsa,djs0,djs1: in std_logic_vector(3 downto 0);en_out : out std_logic_vector(7 downto 0);dataout : out std_logic_vector(3 downto 0);end scan;architecture beh of scan issignal cnt : integer range 0 to 7;signal en : std_logic_vector(7 downto 0);beg

20、in cnt_pro : process(clk1khz) begin if clk1khzevent and clk1khz=1 then if cnt = 7 then cnt = 0; else cnt dataout = fsd;en dataout = fsc;en dataout = fsb;en dataout = fsa;en dataout = djs0;en dataout = djs1;en dataout = 1010;en dataout = 1010;en null; end case; end process scan_pro; en_out dataout da

21、taout dataout dataout dataout dataout dataout dataout dataout dataout dataout dataout dataout dataout dataout dataout null; end case; end process; end beh;IV模块图形:图8 译码器3.3.8蜂鸣器设计I输入/输出:2个不同频率时钟信号输入;2组4位2进制片选信号输入;1个时钟信号输出。II功能:倒计时2、4、6秒时输出提示音;0秒时输出终止音。IIIVHDL程序:library ieee;use ieee.std_logic_1164.al

22、l;use ieee.std_logic_unsigned.all;entity tsy isport ( clk :in std_logic; -zhongzhi clk1:in std_logic; -tishi clk_out :out std_logic; qa:in std_logic_vector(3 downto 0); qb:in std_logic_vector(3 downto 0);end entity tsy;architecture behave of tsy isbegin process(clk,qa,qb) is begin if clkevent and cl

23、k=1 then if (qa=0000and qb=0000)then clk_out=clk; elsif (qa=0100and qb=0000)then clk_out=clk1; elsif (qa=0010and qb=0000)then clk_out=clk1; elsif (qa=0110and qb=0000)then clk_out=clk1; else clk_out=0 ; end if; end if; end process;end architecture behave;IV模块图形:图9 蜂鸣器第四章 调试与仿真结果4.1抢答鉴别电路图10 抢答鉴别电路仿真时

24、序图4.2计时器图11 计时器仿真时序图4.3记分器图12 记分器仿真时序图4.4分频器图13 分频器仿真时序图4.5扫描显示图14 扫描显示仿真时序图4.6译码器图15 译码器仿真时序图4.7蜂鸣器图16 蜂鸣器仿真时序图第五章 调试中遇到的问题及解决的方法5.1 问题1:按键无反应。 解决方法:赋值高低电平给反了,把=1改为=0即可。5.2 问题2:process中addevent and add=1 or minevent and min=1无法编译。 解决方法:process中只能出现一个变化沿,用clkevent and clk=1代替,再进行选择即可。5.3 问题3:数码管显示乱码。 解决方法:数码管位选与段选引脚接反,重新按正确接法分配引脚即可。5.4 问题4:20s计时器到0后变为29。

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1