EDA篮球比赛电子记分牌设计说明.docx
- 文档编号:29347059
- 上传时间:2023-07-22
- 格式:DOCX
- 页数:12
- 大小:39.49KB
EDA篮球比赛电子记分牌设计说明.docx
《EDA篮球比赛电子记分牌设计说明.docx》由会员分享,可在线阅读,更多相关《EDA篮球比赛电子记分牌设计说明.docx(12页珍藏版)》请在冰豆网上搜索。
EDA篮球比赛电子记分牌设计说明
长沙学院
课程设计说明书
题目篮球比赛电子记分牌设计
一、课题名称
篮球比赛电子记分牌设计
二、设计容
设计一个篮球比赛记分牌,使用4位数码管显示倒计时的分钟、秒钟值;2位数码管显示A方得分;2位数码管显示B方得分;使用LED灯作为上、下半场的标志;单次加分值包括1分、2分和3分;半场时间到输出3秒的声光提示;可进行比赛暂停、比赛加时等操作;终场时间到输出5秒的声光提示。
三、设计思路
1、整体设计思路:
根据设计容,可将设计将分为五个模块来设计:
分频计数模块、时间模块、加分模块、动态扫描显示模块、LED灯模块。
2、整体设计流程:
(1)、分频计数模块:
通过分频模块,将试验箱自带的50MHZ的频率分频得到1MZ
以及1HZ的频率
(2)、时间模块:
将计时器的分钟、秒钟,通过借位的方式设计成40分钟的倒计时时钟
(3)、加分模块:
通过拨盘开关的选择,输入A、B队的比赛得分
(4)、动态扫面显示模块:
通过1MHZ的频率,将时间以及A、B队的比赛得分同时扫描显示在数码管上
(5)、LED灯模块:
对上下场的显示,以及比赛结束的灯亮延长显示
四、设计说明
1、设计程序
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
useieee.std_logic_arith.all;
entitybaseketballis
port(clk:
instd_logic;
start,addtime,add1_A,add2_A,add3_A,add1_B,add2_B,add3_B:
instd_logic;--A\Bduijiafenxinhao--比赛开始,A.B队加分信号
stop:
instd_logic;--比赛暂停
led7s_selout:
outstd_logic_vector(7downto0);--数码管位选
led7s:
outstd_logic_vector(6downto0);--7段数码显示管
led_up:
outstd_logic;--上半场亮灯显示
led_down:
outstd_logic;--下半场亮灯显示
led_h_end:
outstd_logic;--半场结束延时亮灯输出
led_f_end:
outstd_logic);--全场结束延时亮灯输出
end;
architectureoneofbaseketballis
constanttime_m:
integer:
=9;--时间分位初始化
constanttime_s:
integer:
=59;--时间秒位初始化
signaltime_m0:
integerrange0to9;--分位时间围
signaltime_s0:
integerrange0to59;--秒位时间围
signalcout_A,cout_B:
integerrange0to99;--比分计数围
signalclk0_1,clk0_1M:
std_logic;--1HZ\1MHZ信号
signalq0_1:
integerrange0to24999999;--1HZ分频计数围
signalq0_1M:
integerrange0to25;--1MHZ分频计数围
signalhalf_end,full_end,add_end:
std_logic;--上下半场结束信号
signalr,a,b,c,d,e,f,g,h:
integerrange0to9;--扫描显示加载信号
signalq1:
integerrange0to7;--动态扫描显示信号围
signalq_3:
integerrange0to3;--s半场比赛结束延时提示
signalq_5:
integerrange0to5;--全场比赛结束延时提示
signalq_t_m:
integerrange0to1;--秒借位
signalq_t_s:
integerrange0to1;--分借位
begin
process(clk)--1MHZ频率
begin
ifclk'eventandclk='1'then
ifq0_1M=25then
q0_1M<=0;
clk0_1M<=notclk0_1M;
elseq0_1M<=q0_1M+1;
endif;
endif;
endprocess;
process(clk)--1HZ频率
begin
ifclk'eventandclk='1'then
ifq0_1=24999999then
q0_1<=0;
clk0_1<=notclk0_1;
else
q0_1<=q0_1+1;
endif;
endif;
endprocess;
process(clk0_1,clk)--时间模块
begin
ifclk0_1'eventandclk0_1='1'then
ifstart='1'then
ifhalf_end='0'andfull_end='0'then
time_s0<=time_s;
led_up<='1';
iftime_m0=0andtime_s0=0then
time_m0<=time_m;
led_up<='0';
half_end<='1';
elsiftime_s0=0then
q_t_m<=1;
time_m0<=time_m0-q_t_m;
else
q_t_s<=1;
time_s0<=time_s0-q_t_s;
endif;
endif;
ifhalf_end='1'andfull_end='0'then
time_s0<=time_s;
led_down<='1';
iftime_m0=0andtime_s0=0then
time_m0<=time_m;
led_down<='0';
full_end<='1';
elsiftime_s0=0then
q_t_m<=1;
time_m0<=time_m0-q_t_m;
else
q_t_s<=1;
time_s0<=time_s0-q_t_s;
endif;
endif;
endif;
ifaddtime='1'andfull_end='1'then--比赛计时
ifadd_end='0'then
time_s0<=time_s;
iftime_m0=0andtime_s0=0then
time_m0<=time_m;
add_end<='1';
elsiftime_s0=0then
q_t_m<=1;
time_m0<=time_m0-q_t_m;
else
q_t_s<=1;
time_s0<=time_s0-q_t_s;
endif;
endif;
endif;
ifstop='1'then
half_end<='0';
full_end<='0';
add_end<='0';
endif;
endif;
endprocess;
process(add1_A,add2_A,add3_A)--A对加分模块
begin
ifadd1_A='1'then
cout_A<=cout_A+1;
endif;
ifadd2_A='1'then
cout_A<=cout_A+2;
endif;
ifadd3_A='1'then
cout_A<=cout_A+3;
endif;
ifstop='1'then
cout_A<=0;
endif;
endprocess;
process(add1_B,add2_B,add3_B)--B对加分模块
begin
ifadd1_B='1'then
cout_B<=cout_B+1;
endif;
ifadd2_B='1'then
cout_B<=cout_B+2;
endif;
ifadd3_B='1'then
cout_B<=cout_B+3;
endif;
ifstop='1'then
cout_B<=0;
endif;
endprocess;
process(clk0_1M,q1)
begin
ifclk0_1M'eventandclk0_1M='1'then
ifq1=7then
q1<=0;
elseq1<=q1+1;
endif;
endif;
endprocess;
process(q1,a,b,c,d,e,f,g,h)--动态扫描显示模块
begin
a<=time_m0/10;
b<=time_m0rem10;
c<=time_s0/10;
d<=time_s0rem10;
e<=cout_A/10;
f<=cout_Arem10;
g<=cout_B/10;
h<=cout_Brem10;
caseq1is
when0=>led7s_selout<="00000001";r<=a;
when1=>led7s_selout<="00000010";r<=b;
when2=>led7s_selout<="00000100";r<=c;
when3=>led7s_selout<="00001000";r<=d;
when4=>led7s_selout<="00010000";r<=e;
when5=>led7s_selout<="00100000";r<=f;
when6=>led7s_selout<="01000000";r<=g;
when7=>led7s_selout<="10000000";r<=h;
whenothers=>null;
endcase;
endprocess;
process(r)
begin
caseris
when0=>led7s<="1000000";
when1=>led7s<="1111001";
when2=>led7s<="0100100";
when3=>led7s<="0110000";
when4=>led7s<="0011001";
when5=>led7s<="0010010";
when6=>led7s<="0000010";
when7=>led7s<="1111000";
when8=>led7s<="0000000";
when9=>led7s<="0010000";
whenothers=>null;
endcase;
endprocess;
process(clk0_1,half_end,full_end)--上下半场灯亮延时提示
begin
ifclk0_1'eventandclk0_1='1'then
ifhalf_end='1'then
ifq_3=3then
led_h_end<='0';
elseq_3<=q_3+1;
led_h_end<='1';
endif;
endif;
iffull_end='1'then
ifq_5=5then
led_f_end<='0';
elseq_5<=q_5+1;
led_f_end<='1';
endif;
endif;
ifstop='1'then
q_3<=0;
q_5<=0;
endif;
endif;
endprocess;
end;
2、引脚分配设置:
3、功能描述
加载程序至试验箱,打开拨盘开关1,比赛开始,LED灯1灭,进行上半场比赛,8个数码显示管依次显示09590000,比赛时间一共10分钟,前四位为时间显示每一秒减计数一次;第五位和第六位为A对比赛分值,当拨动拨盘开关3、4、5时,数码管相应显示加1分、2分、3分;第七位和第八位为B对比赛分值,当拨动拨盘开关6、7、8时,数码管相应显示加1分、2分、3分;打开把盘开关2,比赛暂停,恢复以后比赛继续进行。
当上半场结束以后,比赛停止,LED灯3灭三秒时间提醒。
再次打开拨盘开关1,比赛进行下半场,比赛结束以后,LED灯灭5秒时间提醒。
五、设计心得
这次EDA课程设计历时两个星期,在整整两个星期的日子里,可以说是苦多于甜,但是可以学的到很多很多的东西,同时不仅可以巩固以前所学过的知识,而且学到了很多在书本上所没有学到过的知识。
通过这次设计,进一步加深了对EDA的了解,让我对它有了更加浓厚的兴趣。
在设计过程中遇上了不少的问题,自己的思路与搭档的有些不同,特别是在对时间模块设计上,我的思路是将四个显示位全部都以单个模块的形式编辑,而搭档的想法是在一个模块中完成,综合比较一下,搭档的设计更加的简洁精要,所以我选择了他的思路。
当然在一个模块当中完成对时间的控制并非简单的事情,我们在编程的过程中遇上一些问题,比如说,初始化不正确,倒计时不标准等等,这些困扰了我们很久。
当然,在我们不断地分析,讨论中,问题一个个被解决,记分牌有了雏形。
由于没有设计防抖动,加分过程中会出现连续加分的过程,而这一问题没能很好的解决,这也是本次课程设计的遗憾。
总的来说,本次EDA课程设计在与搭档一起努力下,将课题完成,让我享受到一起与人讨论分析的快乐,是一次不错的体验
六、参考文献
EDA技术实验指导书,谢明华,文希
EDA技术与VHDL,潘松,清华大学,2009
电子设计硬件描述语言VHDL[M],周祖成,北京:
北京学苑,2000
边计年、薛宏熙,用VHDL设计电子线路[M],北京:
清华大学,2000
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- EDA 篮球比赛 电子 记分牌 设计 说明