EDA篮球比赛电子记分牌设计.docx

上传人:doc321 文档编号:12824797 上传时间:2021-12-06 格式:DOCX 页数:12 大小:90.09KB
返回 下载 相关 举报
EDA篮球比赛电子记分牌设计.docx_第1页
第1页 / 共12页
EDA篮球比赛电子记分牌设计.docx_第2页
第2页 / 共12页
EDA篮球比赛电子记分牌设计.docx_第3页
第3页 / 共12页
EDA篮球比赛电子记分牌设计.docx_第4页
第4页 / 共12页
亲,该文档总共12页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《EDA篮球比赛电子记分牌设计.docx》由会员分享,可在线阅读,更多相关《EDA篮球比赛电子记分牌设计.docx(12页珍藏版)》请在三一文库上搜索。

1、长沙学院课程设计说明书题目篮球比赛电子记分牌设计目录一、课题名称2二、设计内容2三、设计思路21、整体设计思路:22、整体设计流程:2四、设计说明21、设计程序32、引脚分配设置:93、功能描述10五、设计心得10六、参考文献111/12一、 课题名称篮球比赛电子记分牌设计二、设计内容设计一个篮球比赛记分牌,使用4 位数码管显示倒计时的分钟、秒钟值;2 位数码管显示A方得分; 2 位数码管显示B 方得分;使用LED 灯作为上、下半场的标志;单次加分值包括1 分、 2分和 3 分;半场时间到输出3 秒的声光提示;可进行比赛暂停、比赛加时等操作;终场时间到输出 5 秒的声光提示。三、设计思路1、整

2、体设计思路:根据设计内容,可将设计将分为五个模块来设计:分频计数模块、时间模块、加分模块、动态扫描显示模块、 LED 灯模块。2、整体设计流程:( 1)、分频计数模块:通过分频模块,将试验箱自带的50MHZ 的频率分频得到1MZ以及 1HZ 的频率( 2)、时间模块:将计时器的分钟、秒钟,通过借位的方式设计成40 分钟的倒计时时钟( 3)、加分模块:通过拨盘开关的选择,输入A、 B 队的比赛得分( 4)、动态扫面显示模块:通过1MHZ 的频率,将时间以及A 、B 队的比赛得分同时扫描显示在数码管上( 5)、 LED 灯模块:对上下场的显示,以及比赛结束的灯亮延长显示四、设计说明2/121、 设

3、计程序library ieee;entity baseketball isport(clk:in std_logic;start,addtime,add1_A,add2_A,add3_A,add1_B,add2_B,add3_B:instd_logic;-ABdui jia fenxin hao-比赛开始,A.B队加分信号stop:in std_logic;-比赛暂停led7s_selout:out std_logic_vector(7 downto 0);- 数码管位选led7s:out std_logic_vector(6 downto 0);-7 段数码显示管led_up:out std

4、_logic;-上半场亮灯显示led_down:out std_logic;- 下半场亮灯显示led_h_end:out std_logic;-半场结束延时亮灯输出led_f_end:out std_logic);-全场结束延时亮灯输出end;architecture one of baseketball isconstant time_m :integer:=9;-时间分位初始化constant time_s :integer:=59;-时间秒位初始化signal time_m0:integer range 0 to 9;-分位时间范围signal time_s0:integer range

5、 0 to 59; - 秒位时间范围signal cout_A,cout_B:integer range 0 to 99;-比分计数范围signal clk0_1,clk0_1M:std_logic;-1HZ1MHZ信号signal q0_1:integer range 0 to 24999999;-1HZ分频计数范围signal q0_1M:integer range 0 to 25;-1MHZ分频计数范围signal half_end,full_end,add_end:std_logic;-上下半场结束信号signal r,a,b,c,d,e,f,g,h:integer range 0 t

6、o 9;- 扫描显示加载信号signal q1:integer range 0 to 7;-动态扫描显示信号范围signal q_3:integer range 0 to 3;-s 半场比赛结束延时提示signal q_5:integer range 0 to 5;-全场比赛结束延时提示signal q_t_m:integer range 0 to 1;- 秒借位signal q_t_s:integer range 0 to 1;-分借位begin频率3/12beginif clk'event and clk='1' thenif q0_1M=25 thenq0_1M&

7、lt;=0;clk0_1M<=not clk0_1M;else q0_1M<=q0_1M+1;end if;end if;end process;process(clk)- 1HZ频率beginif clk'event and clk='1' thenif q0_1=24999999 thenq0_1<=0;clk0_1<=not clk0_1;elseq0_1<=q0_1+1;end if;end if;end process;process(clk0_1,clk)- 时间模块beginif clk0_1'event and cl

8、k0_1='1' thenif start='1'thenif half_end='0' and full_end='0' thentime_s0<=time_s;led_up<='1'if time_m0=0 and time_s0=0 thentime_m0<=time_m;led_up<='0'half_end<='1'elsif time_s0=0 thenq_t_m<=1;time_m0<=time_m0-q_t_m;4/12els

9、eq_t_s<=1;time_s0<=time_s0-q_t_s;end if;end if;if half_end='1' and full_end='0' thentime_s0<=time_s;led_down<='1'if time_m0=0 and time_s0=0 thentime_m0<=time_m;led_down<='0'full_end<='1'elsif time_s0=0 thenq_t_m<=1;time_m0<=time_m0-q

10、_t_m;elseq_t_s<=1;time_s0<=time_s0-q_t_s;end if;end if;end if;if addtime='1' and full_end='1' then-比赛计时if add_end='0' thentime_s0<=time_s;if time_m0=0 and time_s0=0 thentime_m0<=time_m;add_end<='1'elsif time_s0=0 thenq_t_m<=1;time_m0<=time_m0-q_t_

11、m;elseq_t_s<=1;time_s0<=time_s0-q_t_s;end if;end if;5/12end if;if stop='1' thenhalf_end<='0'full_end<='0'add_end<='0'end if;end if;end process;process(add1_A,add2_A,add3_A)-A对加分模块beginif add1_A='1' thencout_A<=cout_A+1;end if;if add2_A='1

12、' thencout_A<=cout_A+2;end if;if add3_A='1' thencout_A<=cout_A+3;end if;if stop='1' thencout_A <=0;end if;end process;process(add1_B,add2_B,add3_B)-B对加分模块beginif add1_B='1' thencout_B<=cout_B+1;end if;if add2_B='1' thencout_B<=cout_B+2;end if;if add

13、3_B='1' thencout_B<=cout_B+3;end if;6/12cout_B <=0;end if;end process;process(clk0_1M,q1)beginif clk0_1M'event and clk0_1M='1' thenif q1=7 thenq1<=0;else q1<=q1+1;end if;end if;end process;process(q1,a,b,c,d,e,f,g,h)- 动态扫描显示模块begina<=time_m0/10;b<=time_m0 rem 10

14、;c<=time_s0/10;d<=time_s0 rem 10;e<=cout_A/10;f<=cout_A rem 10;g<=cout_B/10;h<=cout_B rem 10;case q1 iswhen 0 => led7s_selout<="00000001" r<=a;when 1 => led7s_selout<="00000010" r<=b;when 2 => led7s_selout<="00000100" r<=c;wh

15、en 3 => led7s_selout<="00001000" r<=d;when 4 => led7s_selout<="00010000" r<=e;when 5 => led7s_selout<="00100000" r<=f;when 6 => led7s_selout<="01000000" r<=g;when 7 => led7s_selout<="10000000" r<=h;when ot

16、hers => null;end case;end process;process(r)7/12begincase r iswhen 0=>led7s<="1000000"when 1=>led7s<="1111001"when 2=>led7s<="0100100"when 3=>led7s<="0110000"when 4=>led7s<="0011001"when 5=>led7s<="0010010&

17、quot;when 6=>led7s<="0000010"when 7=>led7s<="1111000"when 8=>led7s<="0000000"when 9=>led7s<="0010000"when others => null;end case;end process;process(clk0_1,half_end,full_end) -上下半场灯亮延时提示 beginif clk0_1'event and clk0_1='1

18、9; thenif half_end='1' thenif q_3=3 thenled_h_end<='0'else q_3<=q_3+1;led_h_end<='1'end if;end if;if full_end='1' thenif q_5=5 thenled_f_end<='0'else q_5<=q_5+1;led_f_end<='1'end if;end if;if stop='1' thenq_3<=0;q_5<=0;8

19、/12end if;end if;end process;end;2、 引脚分配设置:9/123、 功能描述加载程序至试验箱,打开拨盘开关1 ,比赛开始,LED 灯1 灭,进行上半场比赛,8 个数码显示管依次显示09590000 ,比赛时间一共10 分钟,前四位为时间显示每一秒减计数一次;第五位和第六位为A 对比赛分值, 当拨动拨盘开关3、4、5 时,数码管相应显示加1 分、2 分、3 分;第七位和第八位为B 对比赛分值, 当拨动拨盘开关6、7、8 时,数码管相应显示加1 分、2 分、3分;打开把盘开关2,比赛暂停,恢复以后比赛继续进行。当上半场结束以后,比赛停止,LED 灯3 灭三秒时间提醒

20、。再次打开拨盘开关1,比赛进行下半场,比赛结束以后,LED 灯灭5 秒时间提醒。五、设计心得这次 EDA 课程设计历时两个星期,在整整两个星期的日子里,可以说是苦多于甜,但是可以10/12学的到很多很多的东西,同时不仅可以巩固以前所学过的知识,而且学到了很多在书本上所没有学到过的知识。通过这次设计,进一步加深了对 EDA 的了解,让我对它有了更加浓厚的兴趣。在设计过程中遇上了不少的问题,自己的思路与搭档的有些不同,特别是在对时间模块设计上,我的思路是将四个显示位全部都以单个模块的形式编辑,而搭档的想法是在一个模块中完成,综合比较一下,搭档的设计更加的简洁精要,所以我选择了他的思路。当然在一个模

21、块当中完成对时间的控制并非简单的事情,我们在编程的过程中遇上一些问题,比如说,初始化不正确,倒计时不标准等等,这些困扰了我们很久。当然,在我们不断地分析,讨论中,问题一个个被解决,记分牌有了雏形。由于没有设计防抖动,加分过程中会出现连续加分的过程,而这一问题没能很好的解决,这也是本次课程设计的遗憾。总的来说,本次 EDA 课程设计在与搭档一起努力下,将课题完成,让我享受到一起与人讨论分析的快乐,是一次不错的体验六、参考文献EDA 技术实验指导书,谢明华,张文希EDA 技术与 VHDL,潘松,清华大学出版社, 2009电子设计硬件描述语言VHDL M,周祖成,北京:北京学苑出版社,2000边计年、薛宏熙,用VHDL设计电子线路 M ,北京:清华大学出版社,200011/12

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1