當前位置:首頁 » 打游戲機 » 拔河游戲機論文
擴展閱讀
天成解說一個人的游戲 2021-03-16 21:51:02
打游戲什麼牌子顯卡好 2021-03-16 21:51:00

拔河游戲機論文

發布時間: 2021-01-21 13:25:34

㈠ EDA 課程設計 ——拔河游戲機

一、總體設計思想
電子拔河游戲機是一種能容納甲乙雙方參賽游戲電路。由一排發光二極體表示拔河的「電子繩」。由甲乙雙方通過按紐開關使發光二極體向一方的終點延伸,當延伸到某方的最後一個發光二極體時, 則該方獲勝,連續比賽多局以定勝負。

1.基本原理
本電路要求使用9個發光二極體,開機後只有中間一個發亮,此即拔河的中心點。游戲雙方各持一個按鈕,迅速地、不斷地按動,產生脈沖,誰按得快,亮點就向誰的方向移動,每按一次,亮點移動一次。亮點移到任一方終端二極體時,這一方就獲勝,此時雙方按鈕均無作用,輸出保持,只有復位後才使亮點恢復到中心。最後用數碼管顯示獲勝者的盤數。
由設計內容可知,首先需要一個十進制的計數器,用於對雙方按鈕的次數計數,並通過解碼器顯示在數碼管上。設計要求用50MHz的頻率,而設計用到的是1K Hz的頻率,所以要設計一個程序進行分頻。其次,顯視控制部分設計要求在發光二極體上顯示游戲狀態,雙方每按十次,亮點向先按十次移動一次,對脈沖進行計數,每十次移一位。需接入一個清零端 ,用於復位。再次,運用VHDL程序語言進行各個模塊的程序編寫,控制電路的正常運行。最後,將以上程序組裝起來,就可得到所需要的拔河游戲機
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity bahe is
port (a,b,rst,clk:in std_logic;
sg,led:out std_logic_vector(8 downto 0);
bt:out std_logic_vector(7 downto 0));
end bahe;
----------------------------------
architecture one of bahe is
component cnt10
port (clk,rst,en:std_logic;
cout:out std_logic;
cq:out std_logic_vector(3 downto 0));
end component;
component scan
port (clk :in std_logic;
a1, a2,a3,b1,b2,b3:in std_logic_vector(3 downto 0);
sg:out std_logic_vector(8 downto 0);
bt: out std_logic_vector(7 downto 0));
end component;
component lmov
port (kl ,kr:in std_logic_vector(3 downto 0) ;
led:out std_logic_vector(8 downto 0);
en : out std_logic;
rst:in std_logic);
end component;
signal e,f,ca1,ca2,cb1,cb2:std_logic;
signal cqa1,cqa2,cqa3,cqb1,cqb2,cqb3:std_logic_vector(3 downto 0);
begin
u1: cnt10 port map (en=>e,rst=>rst,clk=>a,cout=>ca1,cq=>cqa1);
u2: cnt10 port map (en=>e,rst=>rst,clk=>ca1,cout=>ca2,cq=>cqa2);
u3: cnt10 port map (en=>e,rst=>rst,clk=>ca2,cq=>cqa3);
u4: cnt10 port map (en=>e,rst=>rst,clk=>b,cout=>cb1,cq=>cqb1);
u5: cnt10 port map (en=>e,rst=>rst,clk=>cb1,cout=>cb2,cq=>cqb2);
u6: cnt10 port map (en=>e,rst=>rst,clk=>cb2,cq=>cqb3);
u7: scan port map (a1=>cqa1,a2=>cqa2,a3=>cqa3,b1=>cqb1,
b2=>cqb2,b3=>cqb3,clk=>clk,sg=>sg,bt=>bt);
u8:lmov port map (en=>e,kl=>cqa2,kr=>cqb2,rst=>rst,led=>led);
end architecture one;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity cnt10 is
port(clk,rst,en:std_logic;
cout:out std_logic;
cq:out std_logic_vector(3 downto 0));
end;
architecture one of cnt10 is
begin
process(clk,rst,en)
variable cqi:std_logic_vector(3 downto 0);
begin
if rst='1' then
cqi:=(others=>'0');
elsif clk'event and clk='1' then
if en='1' then
if cqi<9 then cqi:=cqi+1;
else cqi :=(others=>'0');
end if ;
end if;
end if;
if c qi=9 then cout<='0' ;
else cout<='1';
end if;
cq<=cqi;
end process;
end;
電路的VHDL程序如下:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity scan is
port (clk :in std_logic;
a1,a2,a3,b1,b2,b3:in std_logic_vector(3 downto 0);
sg:out std_logic_vector(8 downto 0);
bt: out std_logic_vector(7 downto 0));
end;
architecture one of scan is
signal cnt4:std_logic_vector(2 downto 0);
signal a:std_logic_vector(3 downto 0);
signal clk1:std_logic;
begin
p1:process(cnt4)
begin
case cnt4 is
when "000"=>bt<="10000000";a<=a1;
when "001"=>bt<="01000000";a<=a2;
when "010"=>bt<="00100000";a<=a3;
when "011"=>bt<="00000100";a<=b1;
when "100"=>bt<="00000010";a<=b2;
when "101"=>bt<="00000001";a<=b3;
when others=>bt<="00000000";
end case ;
end process p1;
---------------------------------
p2:process (clk)
variable ct:integer range 0 to 50000;
begin
if clk'event and clk='1' then --1000HZ
if ct<49999 then
ct:=ct+1;
clk1<='0';
else
ct:=0;
clk1<='1';
end if;
end if;
end process p2;
process(clk1)
begin
if clk1'event an d clk1='1' then
if cnt4<5 then
cnt4<=cnt4+1;
else
cnt4<="000";
end if;
end if;
end process;
------------------------------------
process (a)
begin
case a is
when "0000"=>sg<="100000000";
when "0001"=>sg<="111110001";
when "0010"=>sg<="001001000";
when "0011"=>sg<="001100000";
when "0100"=>sg<="000110010";
when "0101"=>sg<="000100100";
when "0110"=>sg<="000000100";
when "0111"=>sg<="111110000";
when "1000"=>sg<="000000000";
when "1001"=>sg<="100011111";
when "1010"=>sg<="000100100";
when "1011"=>sg<="000011000";
when "1100"=>sg<="010001100";
when "1101"=>sg<="001001000";
when "1110"=>sg<="001000000";
when "1111"=>sg<="000011111";
when others=>null;
end case ;
end process;
end;
⑸ 勝負顯示
將雙方終端二極體正極經非門後的輸出分別接到二個CC4518計數器的EN端,CC4518的兩組4位BCD碼分別接到實驗裝置的兩組解碼顯示器的A、B、C、D插口處。當一方取勝時,該方終端二極體發亮,產生一個上升沿,使相應的計數器進行加一計數,於是就得到了雙方取勝次數的顯示,若一位數不夠,則進行二位數的級聯。
⑹ 復位
其VHDL程序如下:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity lmov is
port (kl ,kr:in std_logic_vector(3 downto 0) ;
led:out std_logic_vector(8 downto 0);
en : out std_logic;
rst:in std_logic);
end ;
architecture one of lmov is
begin
process(rst,kl,kr)
begin
if rst='1' then led<="111101111";en<='1';
elsif kl-kr=1 then led<="111011111";en<='1';
elsif kl-kr=2 then led<="110111111";en<='1';
elsif kl-kr=3 then led<="101111111";en<='1';
elsif kl-kr=4 then led<="011111111";en<='0';
elsif kr-kl=1 then led<="111110111";en<='1';
elsif kr-kl=2 then led<="111111011";en<='1' ;
elsif kr-kl=3 then led<="111111101";en<='1';
elsif kl-kr=4 then led<="111111110";en<='0';
elsif kr-kl=0 then led<="111101111";en<='1';
else null;
end if;
end process;
end;

㈡ EDA 課程設計拔河游戲機

一、總體設計思想

電子拔河游戲機是一種能容納甲乙雙方參賽游戲電路。由一排發光二極體表示拔河的「電子繩」。由甲乙雙方通過按紐開關使發光二極體向一方的終點延伸,當延伸到某方的最後一個發光二極體時,則該方獲勝,連續比賽多局以定勝負。

1.基本原理

本電路要求使用9個發光二極體,開機後只有中間一個發亮,此即拔河的中心點。游戲雙方各持一個按鈕,迅速地、不斷地按動,產生脈沖,誰按得快,亮點就向誰的方向移動,每按一次,亮點移動一次。亮點移到任一方終端二極體時,這一方就獲勝,此時雙方按鈕均無作用,輸出保持,只有復位後才使亮點恢復到中心。最後用數碼管顯示獲勝者的盤數。

由設計內容可知,首先需要一個十進制的計數器,用於對雙方按鈕的次數計數,並通過解碼器顯示在數碼管上。設計要求用50MHz的頻率,而設計用到的是1KHz的頻率,所以要設計一個程序進行分頻。其次,顯視控制部分設計要求在發光二極體上顯示游戲狀態,雙方每按十次,亮點向先按十次移動一次,對脈沖進行計數,每十次移一位。需接入一個清零端,用於復位。再次,運用VHDL程序語言進行各個模塊的程序編寫,控制電路的正常運行。最後,將以上程序組裝起來,就可得到所需要的拔河游戲機

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitybaheis

port(a,b,rst,clk:instd_logic;

sg,led:outstd_logic_vector(8downto0);

bt:outstd_logic_vector(7downto0));

endbahe;

----------------------------------

architectureoneofbaheis

componentcnt10

port(clk,rst,en:std_logic;

cout:outstd_logic;

cq:outstd_logic_vector(3downto0));

endcomponent;

componentscan

port(clk:instd_logic;

a1,a2,a3,b1,b2,b3:instd_logic_vector(3downto0);

sg:outstd_logic_vector(8downto0);

bt:outstd_logic_vector(7downto0));

endcomponent;

componentlmov

port(kl,kr:instd_logic_vector(3downto0);

led:outstd_logic_vector(8downto0);

en:outstd_logic;

rst:instd_logic);

endcomponent;

signale,f,ca1,ca2,cb1,cb2:std_logic;

signalcqa1,cqa2,cqa3,cqb1,cqb2,cqb3:std_logic_vector(3downto0);

begin

u1:cnt10portmap(en=>e,rst=>rst,clk=>a,cout=>ca1,cq=>cqa1);

u2:cnt10portmap(en=>e,rst=>rst,clk=>ca1,cout=>ca2,cq=>cqa2);

u3:cnt10portmap(en=>e,rst=>rst,clk=>ca2,cq=>cqa3);

u4:cnt10portmap(en=>e,rst=>rst,clk=>b,cout=>cb1,cq=>cqb1);

u5:cnt10portmap(en=>e,rst=>rst,clk=>cb1,cout=>cb2,cq=>cqb2);

u6:cnt10portmap(en=>e,rst=>rst,clk=>cb2,cq=>cqb3);

u7:scanportmap(a1=>cqa1,a2=>cqa2,a3=>cqa3,b1=>cqb1,

b2=>cqb2,b3=>cqb3,clk=>clk,sg=>sg,bt=>bt);

u8:lmovportmap(en=>e,kl=>cqa2,kr=>cqb2,rst=>rst,led=>led);

endarchitectureone;

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitycnt10is

port(clk,rst,en:std_logic;

cout:outstd_logic;

cq:outstd_logic_vector(3downto0));

end;

architectureoneofcnt10is

begin

process(clk,rst,en)

variablecqi:std_logic_vector(3downto0);

begin

ifrst='1'then

cqi:=(others=>'0');

elsifclk'eventandclk='1'then

ifen='1'then

ifcqi<9thencqi:=cqi+1;

elsecqi:=(others=>'0');

endif;

endif;

endif;

ifcqi=9thencout<='0';

elsecout<='1';

endif;

cq<=cqi;

endprocess;

end;

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityscanis

port(clk:instd_logic;

a1,a2,a3,b1,b2,b3:instd_logic_vector(3downto0);

sg:outstd_logic_vector(8downto0);

bt:outstd_logic_vector(7downto0));

end;

architectureoneofscanis

signalcnt4:std_logic_vector(2downto0);

signala:std_logic_vector(3downto0);

signalclk1:std_logic;

begin

p1:process(cnt4)

begin

casecnt4is

when"000"=>bt<="10000000";a<=a1;

when"001"=>bt<="01000000";a<=a2;

when"010"=>bt<="00100000";a<=a3;

when"011"=>bt<="00000100";a<=b1;

when"100"=>bt<="00000010";a<=b2;

when"101"=>bt<="00000001";a<=b3;

whenothers=>bt<="00000000";

endcase;

endprocessp1;

---------------------------------

p2:process(clk)

variablect:integerrange0to50000;

begin

ifclk'eventandclk='1'then--1000HZ

ifct<49999then

ct:=ct+1;

clk1<='0';

else

ct:=0;

clk1<='1';

endif;

endif;

endprocessp2;

process(clk1)

begin

ifclk1'eventandclk1='1'then

ifcnt4<5then

cnt4<=cnt4+1;

else

cnt4<="000";

endif;

endif;

endprocess;

------------------------------------

process(a)

begin

caseais

when"0000"=>sg<="100000000";

when"0001"=>sg<="111110001";

when"0010"=>sg<="001001000";

when"0011"=>sg<="001100000";

when"0100"=>sg<="000110010";

when"0101"=>sg<="000100100";

when"0110"=>sg<="000000100";

when"0111"=>sg<="111110000";

when"1000"=>sg<="000000000";

when"1001"=>sg<="100011111";

when"1010"=>sg<="000100100";

when"1011"=>sg<="000011000";

when"1100"=>sg<="010001100";

when"1101"=>sg<="001001000";

when"1110"=>sg<="001000000";

when"1111"=>sg<="000011111";

whenothers=>null;

endcase;

endprocess;

end;

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitylmovis

port(kl,kr:instd_logic_vector(3downto0);

led:outstd_logic_vector(8downto0);

en:outstd_logic;

rst:instd_logic);

end;

architectureoneoflmovis

begin

process(rst,kl,kr)

begin

ifrst='1'thenled<="111101111";en<='1';

elsifkl-kr=1thenled<="111011111";en<='1';

elsifkl-kr=2thenled<="110111111";en<='1';

elsifkl-kr=3thenled<="101111111";en<='1';

elsifkl-kr=4thenled<="011111111";en<='0';

elsifkr-kl=1thenled<="111110111";en<='1';

elsifkr-kl=2thenled<="111111011";en<='1';

elsifkr-kl=3thenled<="111111101";en<='1';

elsifkl-kr=4thenled<="111111110";en<='0';

elsifkr-kl=0thenled<="111101111";en<='1';

elsenull;

endif;

endprocess;

end;

㈢ 電子技術課程設計 拔河游戲機 誰能給個做好的WORD文檔啊

一、設計任務分析:
數字電子技術課程設計是數字電子技術基礎課程的實踐性教學環節,是為了理論結合實際的電子基礎知識,驗證,鞏固和消化電子技術基本知識,綜合應用數字電子技術解決生產第一線的實際問題,提高基本的專業動手能力,進一步培養分析問題和解決問題的能力,以後更好的為社會服務。
設計主要內容及要求 :
1、設計一個模擬拔河游戲比賽的邏輯電路。
2、電路使用15個發光二極體,開機後只有在拔河繩子中間的發光二極體亮。
3、比賽雙方各持一個按鈕,快速不斷地按動按鈕,產生脈沖,誰按得快,發光的二極體就向誰的方向移動,每按一次,發光二極體移動一位。
4、亮的發光二極體移到任一方的終點時,該方就獲勝,此後雙方的按鈕都應無作用,狀態保持,只有當栽判按動復位後,在拔河繩子中間的發光二極體重新亮。
5、用七段數碼管顯示雙方的獲勝盤數。
二、實驗設計思路
基本要求如下:
(1)比賽開始時,由裁判下達命令後,甲乙雙方才能輸入信號,否則,由於電路具有自鎖功能,使輸入信號無效。
(2)「電子繩」到少由15個LED管構成, 裁判下達「開始比賽」的命令後,位於「電子繩」中點的LED點亮。甲乙雙方通過按鍵輸入信號,使發亮的LED管向自己一方移動,並阻止其向對方延伸。當從中點至自己一方終點的LED管全部點亮時,表示比賽結束。這時,電路自鎖,保持當前狀態不變,除非由裁判使電路復位。
三、總體設計方案:
3.1、電路設計原理
拔河游戲機需用15個(或9個)發光二極體排列成一行,開機後只有中間一個點亮,以此作為拔河的中心線,游戲雙方各持一個按鍵,迅速地、不斷地按動產生脈沖,誰按得快,亮點向誰方向移動,每按一次,亮點移動一次。移到任一方終端二極體點亮,這一方就得勝,此時雙方按鍵均無作用,輸出保持,只有經復位後才使亮點恢復到中心線。
顯示器顯示勝者的盤數。
.實驗電路如下:
原理:
可逆計數器74LS193原始狀態輸出4位二進制數0000,經解碼器輸出使中間的一隻電平指示燈點亮。當按動A、B兩個按鍵時,分別產生兩個脈沖信號,經整形後分別加到可逆計數器上,可逆計數器輸出的代碼經解碼器解碼後驅動電平指示燈點亮並產生位移,當亮點移到任何一方終端後,由於控制電路的作用,使這一狀態被鎖定,而對輸入脈沖不起作用。如按動復位鍵,亮點又回到中點位置,比賽又可重新開始。
將雙方終端指示燈的正端分別經兩個與非門後接到2個十進制計數器CC4518的使能端EN,當任一方取勝,該方終端指示燈點亮,產生1個下降沿使其對應的計數器計數。這樣,計數器的輸出即顯示了勝者取勝的盤數。
1.編碼電路
編碼器有二個輸入端,四個輸出端,要進行加 / 減計數,因此選用74LS193雙時鍾二進制同步加 / 減計數器來完成。
2.整形電路
74LS193是可逆計數器,控制加減的CP脈沖分別加至5腳和4腳,此時當電路要求進行加法計數時,減法輸入端CPD 必須接高電平;進行減法計數時,加法輸入端CPU 也必須接高電平,若直接由A、B鍵產生的脈沖加到5腳或4腳,那麼就有很多時機在進行計數輸入時另一計數輸入端為低電平,使計數器不能計數,雙方按鍵均失去作用,拔河比賽不能正常進行。加一整形電路,使A、B二鍵出來的脈沖經整形後變為一個占空比很大的脈沖,這樣就減少了進行某一計數時另一計數輸入為低電平的可能性,從而使每按一次鍵都有可能進行有效的計數。整形電路由與門74LS08和與非門74LS00構成。
3.解碼電路:
由4線-16線解碼器CC4514構成。解碼器的輸出Y0~Y15中選出15個接電平指示燈,電平指示燈的負端接地,而正端接解碼器;這樣,當輸出為高電平時電平指示燈點亮。
比賽准備,解碼器輸入為0000,Y0輸出為1,中心處指示燈首先點亮,當編碼器進行加法計數時,亮點向右移,進行減法計數時,亮點向左移。
4.控制電路:
為指示出誰勝誰負,需用一個控制電路。當亮點移到任何一方的終端時,判該方為勝,此時雙方的按鍵均宣告無效。此電路可由或非門74LS02構成。將雙方終端指示燈的正接至或非門的2個輸入端,當獲勝一方為「1」,而另一方則為「0」,或非門輸出為「0」,再送到74LS193計數器的置數端 ,於是計數器停止計數,處於預置狀態,由於計數器數據端D0、D1、D2、D3和輸出Q0、Q1、Q2、Q3對應相連,輸入也就是輸出,從而使計數器對脈沖不起作用。
5.勝負顯示:
將雙方終端指示燈正極經與非門輸出後分別接到二個CC4518計數器的CP端,CC4518的兩組4位BCD碼分別接到實驗箱中的兩組解碼顯示器的8、4、2、1插孔上。當一方取勝時,該方終端指示燈發亮,產生一個上升沿,使相應的計數器進行加一計數,於是就得到了雙方取勝次數的顯示,若一位數不夠,則進行二位數的級連。
6.復位
為能進行多次比賽而需要進行復位操作,使亮點返回中心點,可用一個開關控制74LS193的清零端R即可。
勝負顯示器的復位也應用一個開關來控制勝負計數器CC4518的清零端R,使其重新計數。
CC4518功能表下表所示,引腳排列見附錄。
輸 入 輸出功能
時鍾
CP 清零
RD 使能
EN
× 1 × 全部為0
↑ 0 1 加計數
0 0 ↓
↓ 0 × 保持
× 0 ↑
↑ 0 0
1 0 ↓
另外,團IDC網上有許多產品團購,便宜有口碑