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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

竞赛抢答器设计报告.docx

1、竞赛抢答器设计报告电子技术课程设计报告课题:竞赛抢答器(verilog)学号:U200813539院系:控制科学与工程系专业班级:自动化0806班姓名:许伟波 目录一、 概述 3二、 课题要求 3三、 验收要求 4四、 测试工具平台 4五、 课题分析与理解 4六、 设计思路 51. 模块划分 52. 系统ASM图 6七、 模块代码及仿真 81. 代码编写思路 82. 变量说明 83. 各模块程序与仿真 91) 抢答模块 92) 计时模块 113) 计分模块 134) 显示模块 185) 报警模块 20八、 实验感想 21一、 概述在竞赛、文体娱乐活动(抢答活动)中,能准确、公正、直观地判断出抢

2、答者的机器。通过抢答者的指示灯显示、数码显示和警示显示等手段指示出第一抢答者。 一般抢答器由单片机以及外围电路组成,分为八路十路等不同,八路和十路的差别是,抢答器背面的 接口有几组,和外形没有关系。二、 课题要求1. 设计一个可容纳6组参赛的数字式抢答器,每组设一个按钮,供抢答使用。2. 主持人按复位键后开始抢答。3. 第一个抢答信号可以使其它信号无效。4. 指示灯显示抢答组别。5. 对提前1秒或超时3秒答题的组别鸣笛示警,由组别显示器显示犯规组别。6. 设置一个记分模块,每组开始预设10分,答对加1分,答错减一分。三、 验收要求1. 用Verilog语言对设计进行描述,设计一个测试方案,通过

3、Muxplus对设计进行仿真验证。并能够下载到实验板上调试成功。2. 写出设计性实验报告,并打印各层次的源文件和仿真波形,然后作简要说明。 并谈谈此次实验的收获、感想及建议。四、 测试工具平台编写语言:Verilog编译调试工具:maxplus2五、 课题分析与理解根据题目要求可知,首先需要一个按钮begin让主持人来控制抢答的开始与结束。然后,在选手答完题后需要判断选手回答正确与否,用sub和add来控制加减分。但是由于资源有限,只有八个按键,所以用剩下的五个键k1,k2,k3,k4,k5来控制选手的抢答。所以在这次课设中我只设置了五位抢答选手。再对课题进行进一步分析,用自顶向下的设计方法,

4、由于所需要实现的内容不止一个,所以我们采用分模块的设计理念,先设计独立功能的子程序,再把各个子程序综合起来构成一个整体的系统。这样设计的好处有以下几点:(1) 各子程序之间是相对独立的。某个子程序并不需要知道所调用它的程序是如何实现的,而仅仅需要知道知道该调用程序的接口所提供的服务。由于每一个子程序只实现一种相对独立的功能,因而可将一个难以处理的复杂问题分解为若干个较容易处理的更小的问题。这样,整个问题的复杂程度就降低了。(2)灵活性好。当某个子程序发生变化时(例如技术的变化),只要保证各接口关系不变,则其他程序不受影响。(3)易于实现和维护。这种结构使得实现和调试一个庞大而复杂的系统变得易于

5、处理,因为整个的系统已被分解为若干个相对独立的子系统。电路原理如下图所示:六、 设计思路1. 模块划分在对问题进行分析之后将该程序分成一下模块,如图所示:模块名作用和意义Qiangda当主持人没有按下抢答按钮时,按下抢答按钮选手为犯规选手;当主持人按下抢答按钮时,按下抢答按钮选手为抢到的选手,并用pressed信号锁存。Time_count设置初始时间为五秒,当选手抢到题目时开始计时,当超时3秒时,time_out信号置1,蜂鸣器发出报警声。Score_count设置各位选手的初始分数,主持人通过两个按键对抢答者回答对错进行判断,同时改变其分数。Display将需要数码管输出显示的信号输入,显

6、示犯规组别或者抢答组别,另外四个数码管显示分数和剩余时间。 2. 过程分析通过主持人按键判断强大是否开始,抢答开始前,选手按下抢答按钮,被算为提前抢答,蜂鸣器发出报警声,数码管显示犯规组别。抢答开始后,选手通过抢答按钮进行抢答,当某组抢答成功时显示抢答组别:若该组超时3秒抢答,蜂鸣器报警,抢答无效;若该组在抢答时间内完成作答,主持人可通过加分减分按钮对该组得分进行修改。在某组抢答成功时,其他组抢答按钮被屏蔽,按钮无效,只有当主持人按下第二次抢答信号时可以再次抢答。七、 模块代码及仿真1. 代码编写思路在分完模块后,根据ASM图进行各个模块的编程,再将各个模块通过顶层模块连接起来,合成一个完整的

7、系统。2. 各模块程序与仿真1) 抢答模块a) 代码module qiangda(k1,k2,k3,k4,k5,cp1024hz,reset,tqqd,pressed,zbxs);input k1,k2,k3,k4,k5,cp1024hz,reset;output tqqd,pressed;output 3:0zbxs;reg tqqd,pressed;reg3:0zbxs;always(posedge cp1024hz)begin if(!reset)/没开始抢答 begin pressed=0; zbxs=0; if(k1=1) begin zbxs=1; tqqd=1; end else

8、 if(k2=1) begin zbxs=2; tqqd=1; end else if(k3=1) begin zbxs=3; tqqd=1; end else if(k4=1) begin zbxs=4; tqqd=1; end else if(k5=1) begin zbxs=5; tqqd=1; end end else/reset=1,主持人按下开始键 begin tqqd=0; if(k1=1&pressed=0) begin pressed=1; zbxs=1; end else if(k2=1&pressed=0) begin pressed=1; zbxs=2; end els

9、e if(k3=1&pressed=0) begin pressed=1; zbxs=3; end else if(k4=1&pressed=0) begin pressed=1; zbxs=4; end else if(k5=1&pressed=0) begin pressed=1; zbxs=5; end endendendmoduleb) 仿真2) 计时模块a) 代码module time_count(cp1024hz,reset,pressed,time_left,time_out);input cp1024hz,reset,pressed;output3:0 time_left;ou

10、tput time_out;reg 3:0 time_left;reg time_out;reg9:0 temp_count;/中间变量,1023时计一秒reg3:0 temp_time;/实现延时3秒always (posedge cp1024hz)/计时模块begin if(!reset) begin time_left=5; time_out=0; temp_count=0; temp_time=8; end else begin if(temp_time=0) begin time_out=1; end if(pressed)/有人抢答开始计时 begin if(temp_count=

11、1023) begin temp_count1&time_left0) begin time_left=time_left-1; temp_time1&time_left=0) begin temp_time=temp_time-1; time_left=0; end else/超时三秒 begin temp_time=0; time_out=1; end end else begin temp_count=temp_count+1; end end end endendmoduleb) 仿真3) 计分模块a) 代码module score_count(cp1024hz,add,sub,zbx

12、s,reset,score11,score12,score21,score22,score31,score32,score41,score42,score51,score52);input add,sub,cp1024hz,reset;input 3:0zbxs;output3:0 score11,score12,score21,score22,score31,score32,score41,score42,score51,score52;reg 3:0score11,score12,score21,score22,score31,score32,score41,score42,score51

13、,score52;real init_score;/计分模块real init_pf;always(posedge cp1024hz)if(!init_score) /初始化分数begin score11=0; score12=1; score21=0; score22=1; score31=0; score32=1; score41=0; score42=1; score51=0; score52=1; init_score=1;endelse if(init_score&!reset)/锁存评分信号begininit_pf=0;endelse if(init_score&reset&ini

14、t_pf=0)begin if(zbxs=1&add=1) begin if(score11=9) begin score11=0; score12=score12+1; init_pf=1; end else begin score11=score11+1; init_pf=1; end end else if(zbxs=1&sub=1) begin if(score11=0) begin score11=9; score12=score12-1; init_pf=1; end else begin score11=score11-1; init_pf=1; end end else if(

15、zbxs=2&add=1) begin if(score21=9) begin score21=0; score22=score22+1; init_pf=1; end else begin score21=score21+1; init_pf=1; end end else if(zbxs=2&sub=1) begin if(score21=0) begin score21=9; score22=score22-1; init_pf=1; end elsebegin score21=score21-1; init_pf=1;end end else if(zbxs=3&add=1) begi

16、n if(score31=9) begin score31=0; score32=score32+1; init_pf=1; end elsebegin score31=score31+1; init_pf=1;end end else if(zbxs=3&sub=1) begin if(score31=0) begin score31=9; score32=score32-1; init_pf=1; end elsebegin score31=score31-1; init_pf=1;end end else if(zbxs=4&add=1) begin if(score41=9) begi

17、n score41=0; score42=score42+1; init_pf=1; end elsebegin score41=score41+1; init_pf=1;end end else if(zbxs=4&sub=1) begin if(score41=0) begin score41=9; score42=score42-1; init_pf=1; end elsebegin score41=score41-1; init_pf=1;end end else if(zbxs=5&add=1) begin if(score51=9) begin score51=0; score52

18、=score52+1; init_pf=1; end elsebegin score51=score51+1; init_pf=1;end end else if(zbxs=5&sub=1) begin if(score51=0) begin score51=9; score52=score52-1; init_pf=1; end elsebegin score51=score51-1; init_pf=1;end endendendendmoduleb) 仿真4) 显示模块a) 代码module display(cp1024hz,reset,score11,score12,score21,s

19、core22,score31,score32,score41,score42,score51,score52,zbxs,scorea,scoreb);input cp1024hz,reset;input 3:0score11,score12,score21,score22,score31,score32,score41,score42,score51,score52,zbxs;output 3:0scorea,scoreb;reg 3:0scorea,scoreb;always (posedge cp1024hz)begin if(!reset) begin scorea=0; scoreb=

20、0; end else begin if(zbxs=1) begin scorea=score11; scoreb=score12; end else if(zbxs=2) begin scorea=score21; scoreb=score22; end else if(zbxs=3) begin scorea=score31; scoreb=score32; end else if(zbxs=4) begin scorea=score41; scoreb=score42; end else if(zbxs=5) begin scorea=score51; scoreb=score52; e

21、nd endendendmodule b) 仿真5) 报警模块a) 代码module sound_alarm(reset,cp1024hz,tqqd,time_out,alarm);input reset,cp1024hz;input tqqd,time_out;output alarm; reg alarm; reg 9:0 temp_count;reg temp;always (posedge cp1024hz)begin if(!reset) begin alarm=temp; temp_count=0; if(tqqd=1) begin if(temp_count=10) begin

22、temp=1; end else temp_count=temp_count+1; end end else begin alarm=temp; temp_count=0; if(time_out=1) begin if(temp_count=10) begin temp=1; end else temp_count=temp_count+1; end endendendmoduleb) 仿真八、 实验感想这次电子技术课程设计,让我对以前不够明白真正理解的知识,有了更加深一步的学习和了解。通过五个星期的学习和探索,我利用自己的课外时间看了很多verilog的教程,并且通过查看资料自己设计完成了

23、一个竞赛抢答器。同时我进一步学习了maxplus2软件的使用和连接到试验箱进行调试,对整个系统的测试起到了很大的作用。在仿真和调试的过程中,我再次复习了软件的的使用方法,复习了以前学过的怎么样编译程序 、怎么样生成波形文件,怎样下载到实验板上验证设计是否符合要求。在这次的设计中我遇到了3个问题。第一个就是,由于系统时钟是1024hz的,在进行加减分时是在每一个上升沿触发的,一次按键就会触发多次加减分操作,刚开始不知道怎么去实现在一次抢答过程中只进行一次加减分,和同学讨论后,设置了一个中间变量init_pf,此信号在reset信号为0时进行清零,在一次加减分后,赋值为1避免二次赋值。第二个问题是

24、,因为各位选手的初始分数是10分,如何在整个过程中只进行一次赋值,其实这个问题和第一个问题差不多,只要不进行清零就行。我遇到的最后一个问题是在报警模块中出现了问题,刚开始以为只要给个高电平蜂鸣器就会发出报警声,下载到实验板上后一直没有声音,后来知道是给一个时钟信号,不过修改也很简单,由于我用的系统时钟是1024hz的,将高电平与系统时钟相与就得以实现了。当然遇到困难在所难免,最主要的是我学到了很多。通过这次课程设计,加强了我们动手、思考和解决问题的能力。在设计过程中,经常会遇到这样那样的情况,自己编程时候的思路和下载到实验板上是有区别的,实际情况更为复杂,因此耗费在这上面的时间用去很多。通过这次课程设计使我懂得了理论与实际相结合是很重要的,只有理论知识是远远不够的,只有把所学的理论知识与实践相结合起来,从理论中得出结论,才能真正为社会服务,从而提高自己的实际动手能力和独立思考的能力。最后衷心感谢老师的悉心授课和同学门的热心帮助!

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

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