




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、信息技術(shù)學(xué)院可編程邏輯器件原理及應(yīng)用課程綜合設(shè)計(jì)報(bào)告書姓 名: 班 級: 學(xué) 號: 時(shí) 間: 指導(dǎo)教師: 設(shè)計(jì)題目拔河游戲機(jī) 設(shè)計(jì)要求和任務(wù)電子拔河游戲機(jī)是一種能容納甲乙雙方參賽游戲電路。由一排發(fā)光二極管表示拔河的“電子繩”。由甲乙雙方通過按紐開關(guān)使發(fā)光二極管向一方的終點(diǎn)延伸,當(dāng)延伸到某方的最后一個(gè)發(fā)光二極管時(shí), 則該方獲勝,連續(xù)比賽多局以定勝負(fù)?;疽螅?、設(shè)計(jì)一個(gè)能進(jìn)行拔河游戲的電路。2、電路使用9個(gè)發(fā)光二極管,開機(jī)后只有中間一個(gè)發(fā)亮,此即拔河的中心點(diǎn)。3、游戲雙方各持一個(gè)按鈕,迅速地、不斷地按動(dòng),產(chǎn)生脈沖,誰按得快,亮點(diǎn)就向誰的方向移動(dòng),每按一次,亮點(diǎn)移動(dòng)一次。4、亮點(diǎn)移到任一方終端二
2、極管時(shí),這一方就獲勝,此時(shí)雙方按鈕均無作用,輸出保持,只有復(fù)位后才使亮點(diǎn)恢復(fù)到中心。5、用數(shù)碼管顯示獲勝者的盤數(shù)。設(shè)計(jì)過程一、總體設(shè)計(jì)思想 1.基本原理電子拔河游戲機(jī)是一種能容納甲乙雙方參賽游戲電路。由一排發(fā)光二極管表示拔河的“電子繩”。由甲乙雙方通過按紐開關(guān)使發(fā)光二極管向一方的終點(diǎn)延伸,當(dāng)延伸到某方的最后一個(gè)發(fā)光二極管時(shí), 則該方獲勝,連續(xù)比賽多局以定勝負(fù)。本電路要求使用9個(gè)發(fā)光二極管,開機(jī)后只有中間一個(gè)發(fā)亮,此即拔河的中心點(diǎn)。游戲雙方各持一個(gè)按鈕,迅速地、不斷地按動(dòng),產(chǎn)生脈沖,誰按得快,亮點(diǎn)就向誰的方向移動(dòng),每按一次,亮點(diǎn)移動(dòng)一次。亮點(diǎn)移到任一方終端二極管時(shí),這一方就獲勝,此時(shí)雙方按鈕均無
3、作用,輸出保持,只有復(fù)位后才使亮點(diǎn)恢復(fù)到中心。最后用數(shù)碼管顯示獲勝者的盤數(shù)。由設(shè)計(jì)內(nèi)容可知,首先需要一個(gè)十進(jìn)制的計(jì)數(shù)器,用于對雙方按鈕的次數(shù)計(jì)數(shù),并通過譯碼器顯示在數(shù)碼管上。設(shè)計(jì)用到的是1k hz的頻率,所以要設(shè)計(jì)一個(gè)程序進(jìn)行分頻。其次,顯視控制部分設(shè)計(jì)要求在發(fā)光二極管上顯示游戲狀態(tài),雙方每按十次,亮點(diǎn)向先按十次移動(dòng)一次,對脈沖進(jìn)行計(jì)數(shù),每十次移一位。需接入一個(gè)清零端 ,用于復(fù)位。再次,運(yùn)用vhdl程序語言進(jìn)行各個(gè)模塊的程序編寫,控制電路的正常運(yùn)行。最后,將以上程序組裝起來,就可得到所需要的拔河游戲機(jī)。2.設(shè)計(jì)框圖圖1. 拔河機(jī)游戲機(jī)框圖二、設(shè)計(jì)步驟和調(diào)試過程1、總體設(shè)計(jì)電路電子拔河游戲機(jī)是一
4、種能容納甲乙雙方參賽游戲電路。由一排發(fā)光二極管表示拔河的“電子繩”。由甲乙雙方通過按紐開關(guān)使發(fā)光二極管向一方的終點(diǎn)延伸,當(dāng)延伸到某方的最后一個(gè)發(fā)光二極管時(shí), 則該方獲勝,連續(xù)比賽多局以定勝負(fù)。圖2.系統(tǒng)rtl圖示2、模塊設(shè)計(jì)和相應(yīng)模塊程序1、文件名:bahe 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
5、_logic_vector(7 downto 0);end bahe;architecture one of bahe iscomponent cnt10port (clk,rst,en:std_logic;cout:out std_logic;cq:out std_logic_vector(3 downto 0);end component;component scanport (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);b
6、t: out std_logic_vector(7 downto 0);end component;component lmovport (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)
7、;beginu1: 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=>c
8、qb1);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
9、,kl=>cqa2,kr=>cqb2,rst=>rst,led=>led);end architecture one;2、文件名:scanlibrary ieee; -數(shù)碼管顯示模塊use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity scan isport (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_
10、logic_vector(7 downto 0);end;architecture one of scan issignal cnt4:std_logic_vector(2 downto 0);signal a :std_logic_vector(3 downto 0);signal clk1:std_logic;beginp1:process(cnt4)begincase cnt4 iswhen "000"=>bt<="10000000"a<=a1;when "001"=>bt<="01000
11、000"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&
12、quot;end case ;end process p1;p2:process (clk)variable ct:integer range 0 to 50000;beginif clk'event and clk='1' then -1000hzif ct<49999 thenct:=ct+1;clk1<='0'elsect:=0;clk1<='1'end if;end if;end process p2;process(clk1)beginif clk1'event and clk1='1'
13、 then if cnt4<5 thencnt4<=cnt4+1;elsecnt4<="000"end if;end if;end process;process (a)begincase a iswhen "0000"=>sg<="100000000" when "0001"=>sg<="111110001"when "0010"=>sg<="001001000" when "0011&qu
14、ot;=>sg<="001100000" when "0100"=>sg<="000110010" when "0101"=>sg<="000100100"when "0110"=>sg<="000000100" when "0111"=>sg<="111110000" when "1000"=>sg<="00000
15、0000" when "1001"=>sg<="100011111" when "1010"=>sg<="000100100" when "1011"=>sg<="000011000" when "1100"=>sg<="010001100" when "1101"=>sg<="001001000" when "111
16、0"=>sg<="001000000" when "1111"=>sg<="000011111" when others=>null;end case ;end process;end;3、文件名:cnt10library ieee; -頻率計(jì)數(shù)模塊 use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all; entity cnt10 isport(clk,rst,en:std_logic;cout:out std_logic;cq:
17、out std_logic_vector(3 downto 0) );end;architecture one of cnt10 isbeginprocess(clk,rst,en)variable cqi:std_logic_vector(3 downto 0); beginif rst='1' thencqi:=(others=>'0');elsif clk'event and clk='1' thenif en='1' thenif cqi<9 then cqi:=cqi+1;else cqi :=(ot
18、hers=>'0');end if ;end if;end if;if cqi=9 then cout<='0' ;else cout<='1'end if;cq<=cqi;end process;end;4、文件名:imovlibrary ieee; -led指示模塊use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity lmov isport (kl ,kr:in std_logic_vector(3 downto 0) ; led:out
19、std_logic_vector(8 downto 0); en : out std_logic;rst:in std_logic);end ;architecture one of lmov isbeginprocess(rst,kl,kr)beginif rst='1' then led<="111101111"en<='1'elsif kl-kr=1 then led<="111011111"en<='1' elsif kl-kr=2 then led<="11
20、0111111"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
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 動(dòng)漫制作合同范本
- 農(nóng)村地抵押合同范例
- 買賣鞋合同范例
- 公路發(fā)包合同范本
- 買斷企業(yè)產(chǎn)品合同范本
- 代辦檢測合同范本
- 企業(yè)bt項(xiàng)目合同范本
- 三方工程合同范本
- 冷庫改造項(xiàng)目合同范本
- 包干服務(wù)合同范例
- (高清版)WST 402-2024 臨床實(shí)驗(yàn)室定量檢驗(yàn)項(xiàng)目參考區(qū)間的制定
- 中英對照版-中文版-The-Dead-By-James-Joyces死者-詹姆斯-喬伊斯
- 清水河儲能電站施工方案設(shè)計(jì)
- 低溫絕熱液氧瓶充裝操作規(guī)程模版(2篇)
- (正式版)JBT 11517-2024 刮板取料機(jī)
- 大眾汽車使用說明書
- 小學(xué)科學(xué)湘科版五年級下冊全冊教案2023春
- 2024年學(xué)校法制副校長工作職責(zé) 法制副校長聘任書(5篇)
- 《鄧稼先》公開課一等獎(jiǎng)創(chuàng)新教學(xué)設(shè)計(jì)
- (高清版)DZT 0145-2017 土壤地球化學(xué)測量規(guī)程
- 老舊小區(qū)物業(yè)管理方案
評論
0/150
提交評論