![EDA拔河游戲機(jī)課程設(shè)計(jì)_第1頁](http://file4.renrendoc.com/view/b95e07c6e43b7722d21c7e553ec89964/b95e07c6e43b7722d21c7e553ec899641.gif)
![EDA拔河游戲機(jī)課程設(shè)計(jì)_第2頁](http://file4.renrendoc.com/view/b95e07c6e43b7722d21c7e553ec89964/b95e07c6e43b7722d21c7e553ec899642.gif)
![EDA拔河游戲機(jī)課程設(shè)計(jì)_第3頁](http://file4.renrendoc.com/view/b95e07c6e43b7722d21c7e553ec89964/b95e07c6e43b7722d21c7e553ec899643.gif)
![EDA拔河游戲機(jī)課程設(shè)計(jì)_第4頁](http://file4.renrendoc.com/view/b95e07c6e43b7722d21c7e553ec89964/b95e07c6e43b7722d21c7e553ec899644.gif)
![EDA拔河游戲機(jī)課程設(shè)計(jì)_第5頁](http://file4.renrendoc.com/view/b95e07c6e43b7722d21c7e553ec89964/b95e07c6e43b7722d21c7e553ec899645.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
EDA拔河游戲機(jī)課程設(shè)計(jì)__學(xué)院課程設(shè)計(jì)題目:EDA拔河游戲機(jī)課程設(shè)計(jì)作者:
__專業(yè):
自動化班級:
__學(xué)號:
__指導(dǎo)老師:
___月_日重要內(nèi)容、基本規(guī)定、重要參考資料等重要內(nèi)容:
電子拔河游戲機(jī)是一種能容納甲乙雙方參賽游戲電路。由一排發(fā)光二極管表達(dá)拔河的“電子繩”。由甲乙雙方通過按紐開關(guān)使發(fā)光二極管向一方的終點(diǎn)延伸,當(dāng)延伸到某方的最后一種發(fā)光二極管時,則該方獲勝,持續(xù)比賽多局以定勝負(fù)。
基本規(guī)定:
1、設(shè)計(jì)一種能進(jìn)行拔河游戲的電路。
2、電路使用9個發(fā)光二極管,開機(jī)后只有中間一種發(fā)亮,此即拔河的中心點(diǎn)。
3、游戲雙方各持一種按鈕,快速地、不停地按動,產(chǎn)生脈沖,誰按得快,亮點(diǎn)就向誰的方向移動,每按一次,亮點(diǎn)移動一次。
4、亮點(diǎn)移到任一方終端二極管時,這一方就獲勝,此時雙方按鈕均無作用,輸出保持,只有復(fù)位后才使亮點(diǎn)恢復(fù)到中心。
5、用數(shù)碼管顯示獲勝者的盤數(shù)。
重要參考資料:
潘松著.EDA技術(shù)實(shí)用教程(第二版).北京:科學(xué)出版社,.康華光主編.電子技術(shù)基礎(chǔ)模擬部分.北京:高教出版社,.閻石主編.數(shù)字電子技術(shù)基礎(chǔ).北京:高教出版社,.一、總體設(shè)計(jì)思想1.基本原理由設(shè)計(jì)內(nèi)容可知,需要一種十進(jìn)制的計(jì)數(shù)器,用于對雙方按鈕的次數(shù)計(jì)數(shù),并通過譯碼器顯示在數(shù)碼管上。設(shè)計(jì)規(guī)定用50MHz的頻率,而設(shè)計(jì)用到的是1KHz的頻率,因此要設(shè)計(jì)一種程序進(jìn)行分頻。顯視控制部分設(shè)計(jì)規(guī)定在發(fā)光二極管上顯示游戲狀態(tài),雙方每按十次,亮點(diǎn)向先按十次移動一次,對脈沖進(jìn)行計(jì)數(shù),每十次移一位。需接入一種清零端,用于復(fù)位。將以上程序組裝起來。
2.設(shè)計(jì)框圖譯碼器編碼電路選擇開關(guān)整形電路可逆計(jì)數(shù)器控制電路圖1.拔河機(jī)游戲機(jī)框圖二、設(shè)計(jì)環(huán)節(jié)和調(diào)試過程1、總體設(shè)計(jì)電路總體電路圖和仿真圖如圖(25)所示,由仿真圖可知,此電路設(shè)計(jì)無誤,能夠?qū)崿F(xiàn)按動A、B兩個按鍵時,分別產(chǎn)生兩個脈沖信號,經(jīng)整形后分別加到可逆計(jì)數(shù)器上,可逆計(jì)數(shù)器輸出的代碼經(jīng)譯碼器譯碼后驅(qū)動電平批示燈點(diǎn)亮并產(chǎn)生位移,當(dāng)亮點(diǎn)移到任何一方終端后,由于控制電路的作用,使這一狀態(tài)被鎖定,雙方按鍵產(chǎn)生的輸入脈沖不起作用。如按動復(fù)位鍵C,亮點(diǎn)又回到中點(diǎn)位置,再次按C鍵則比賽又可重新開始。
圖2.電路圖2、模塊設(shè)計(jì)和對應(yīng)模塊程序1.頂層文獻(xiàn)libraryIEEE;useIEEE.std_logic_1164.all;useIEEE.std_logic_unsigned.all;entitybaheisport(player1,player2:instd_logic;__玩家1,2輸入clk_in:instd_logic;__clk_in(1MHZ)reset:instd_logic;__重置鍵row:outstd_logic_vector(7downto0);col:outstd_logic_vector(7downto0);led:outstd_logic_vector(7downto0);__繩子cats:outstd_logic_vector(6downto0);__比分q:outstd_logic_vector(5downto0);__數(shù)碼管控制mus:outstd_logic);__蜂鳴輸出endbahe;architecturebody_baheofbaheis__分頻模塊ponentdivisionport(clk_in:instd_logic;__1MHZ輸入clk_100,clk_5,clk_1:outstd_logic);__100HZ,5Hz,1HZendponent;__計(jì)數(shù)模塊ponentcountport(clk_1:instd_logic;__1HZ輸入sw:instd_logic;__狀態(tài)開關(guān)player1,player2:instd_logic;__選手輸入sum1,sum2:outstd_logic_vector(4downto0));__計(jì)數(shù)成果輸出endponent;__比較模塊ponentcmpport(clk_100:instd_logic;__100hzclk_1:instd_logic;__1hzsw:outstd_logic;__狀態(tài)開關(guān)輸出reset:instd_logic;__重置start:instd_logic;__開始sum1,sum2:instd_logic_vector(4downto0);__計(jì)數(shù)成果輸入music_begin:outstd_logic;__音樂record1,record2:outstd_logic_vector(1downto0);__比分輸出lights:outstd_logic_vector(2downto0));__拔河繩子顯示endponent;__音樂模塊ponentmusicport(reset:instd_logic;__重置clk:instd_logic;__1MHzclk_5:instd_logic;__5hzmusic_begin:instd_logic;__音樂開始mus:outstd_logic);endponent;__譯碼模塊ponentdecodeport(clk_in:instd_logic;__1mHZrecord1,record2:instd_logic_vector(1downto0);__比分輸入lights:instd_logic_vector(2downto0);__拔河繩子輸入led:outstd_logic_vector(7downto0);__輸出到LEDq:bufferstd_logic_vector(5downto0);__數(shù)碼管控制cats:outstd_logic_vector(6downto0)__數(shù)碼管顯示比分);endponent;__倒計(jì)時模塊ponentdaojishiport(clk_in,clk_1,reset:instd_logic;row:outstd_logic_vector(7downto0);col:outstd_logic_vector(7downto0);start:outstd_logic);endponent;__分頻器輸出signalclk_100,clk_5,clk_1:std_logic;__時鐘信號__計(jì)數(shù)器輸出signalsum1,sum2:std_logic_vector(4downto0);__計(jì)數(shù)成果__比較器輸出signalsw:std_logic;__狀態(tài)開關(guān)signalrecord1,record2:std_logic_vector(1downto0);__比分signallights:std_logic_vector(2downto0);__繩子signalmusic_begin:std_logic;__解碼器輸出signaltmp_led:std_logic_vector(7downto0);__LED顯示signaltmp_q:std_logic_vector(5downto0);__數(shù)碼管控制signaltmp_cat:std_logic_vector(6downto0);__數(shù)碼管顯示比分__倒計(jì)時器輸出signaltmp_start:std_logic;begincats=tmp_cat;q=tmp_q;led=tmp_led;div:divisionportmap(clk_in=clk_in,clk_100=clk_100,clk_5=clk_5,clk_1=clk_1);cnt:countportmap(clk_1=clk_1,sw=sw,player1=player1,player2=player2,sum1=sum1,sum2=sum2);:cmpportmap(clk_100=clk_100,clk_1=clk_1,sw=sw,reset=reset,start=tmp_start,sum1=sum1,sum2=sum2,music_begin=music_begin,record1=record1,record2=record2,lights=lights);dec:decodeportmap(clk_in=clk_in,record1=record1,record2=record2,lights=lights,led=tmp_led,q=tmp_q,cats=tmp_cat);mu:musicportmap(reset=reset,clk=clk_in,clk_5=clk_5,music_begin=music_begin,mus=mus);dao:daojishiportmap(clk_in=clk_in,clk_1=clk_1,reset=reset,start=tmp_start,col=col,row=row);endbody_bahe;2.CMP模塊libraryIEEE;useIEEE.std_logic_1164.all;useIEEE.std_logic_unsigned.all;entitycmpisport(clk_100:instd_logic;__100HZ輸入clk_1:instd_logic;__1HZ輸入reset:instd_logic;__重置start:instd_logic;__開始sum1,sum2:instd_logic_vector(4downto0);__計(jì)數(shù)輸入record1,record2:outstd_logic_vector(1downto0);__比分輸出music_begin:outstd_logic;__音樂開始sw:outstd_logic;__狀態(tài)輸出lights:outstd_logic_vector(2downto0));__繩子狀態(tài)endcmp;architecturebody_cmpofcmpissignaltmp_record1:std_logic_vector(1downto0);__比分signaltmp_record2:std_logic_vector(1downto0);signaltmp:std_logic_vector(2downto0);__繩子狀態(tài)signaltmp_sta:std_logic;__狀態(tài)signals1,s2:std_logic_vector(4downto0);__計(jì)數(shù)beginrecord1=tmp_record1;record2=tmp_record2;lights=tmp;sw=tmp_sta;process(clk_100)__判斷比賽狀態(tài)beginif(start='1')thenif(clk_100'eventandclk_100='1')thentmp_sta='1';endif;endif;if(clk_100'eventandclk_100='1')then__任意比分到3,比賽結(jié)束,開始播放音樂if(tmp_record1=“11“ortmp_record2=“11“)thentmp_sta='0';music_begin='1';endif;if(tmp=“001“ortmp=“111“)then__繩子到頭,進(jìn)入等待狀態(tài)tmp_sta='0';endif;if(reset='1')then__復(fù)位,狀態(tài)歸零tmp_sta='0';music_begin='0';endif;endif;endprocess;s1=sum1;s2=sum2;process(clk_1,reset)__控制繩子移位beginif(reset='1')thentmp=“100“;__繩子初始狀態(tài)為100tmp_record1=“00“;tmp_record2=“00“;elseif(clk_1'eventandclk_1='1')thenif(tmp_sta='1')thenif(s1s2)thentmp=tmp-'1';__繩子左移elsif(s1=s2)thentmp=tmp;__繩子保持原狀elsetmp=tmp+'1';__繩子右移endif;elseif(tmp=“001“)then__繩子到左盡頭,左計(jì)分器加1tmp_record1=tmp_record1+'1';tmp=“100“;elsif(tmp=“111“)then__繩子到右盡頭,右記分器加1,tmp_record2=tmp_record2+'1';tmp=“100“;endif;endif;endif;endif;endprocess;endbody_cmp;3.COUT模塊useIEEE.std_logic_1164.all;useIEEE.std_logic_unsigned.all;entitycountislibraryIEEE;port(clk_1:instd_logic;__1HZ輸入sw:instd_logic;__狀態(tài)判斷輸入player1,player2:instd_logic;__選手輸入sum1,sum2:outstd_logic_vector(4downto0));__計(jì)數(shù)輸出endcount;architecturebody_countofcountissignalp1,p2:std_logic_vector(4downto0);__計(jì)數(shù)輸出beginsum1sum2process(player1,player2,sw,clk_1)beginif(sw='1')then__處在比賽狀態(tài)if(clk_1='0')thenif(player1'eventandplayer1='1')thenp1=p1+'1';endif;if(player2'eventandplayer2='1')thenp2=p2+'1';endif;elsep1=“00000“;p2=“00000“;endif;__比賽狀態(tài)結(jié)束elsep1=“00000“;p2=“00000“;endif;endprocess;endbody_count;4.daojishi模塊libraryIEEE;useIEEE.std_logic_1164.all;useIEEE.std_logic_unsigned.all;entitydaojishiisport(clk_1,clk_in,reset:instd_logic;row:outstd_logic_vector(7downto0);col:outstd_logic_vector(7downto0);start:outstd_logic);enddaojishi;architecturebody_daojishiofdaojishiistypestateis(s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10);signalpresent_state:state:=s10;signalnum:std_logic_vector(2downto0):=“000“;beginp3:process(clk_in)beginifclk_in'eventandclk_in='1'thenifnum=“101“thennum=“000“;elsenum=num+1;casepresent_stateiswhens9=casenumiswhen“000“=col=“__“;row=“__“;when“001“=col=“__“;row=“__“;when“010“=col=“__“;row=“__“;when“011“=col=“__“;row=“__“;when“100“=col=“__“;row=“__“;whenothers=col=“__“;row=“__“;endcase;whens8=casenumiswhen“000“=col=“__“;row=“__“;when“001“=col=“__“;row=“__“;when“010“=col=“__“;row=“__“;when“011“=col=“__“;row=“__“;when“100“=col=“__“;row=“__“;whenothers=col=“__“;row=“__“;endcase;whens7=casenumiswhen“000“=col=“__“;row=“__“;when“001“=col=“__“;row=“__“;when“010“=col=“__“;row=“__“;when“011“=col=“__“;row=“__“;when“100“=col=“__“;row=“__“;whenothers=col=“__“;row=“__“;endcase;whens6=casenumiswhen“000“=col=“__“;row=“__“;when“001“=col=“__“;row=“__“;when“010“=col=“__“;row=“__“;when“011“=col=“__“;row=“__“;when“100“=col=“__“;row=“__“;whenothers=col=“__“;row=“__“;endcase;whens5=casenumiswhen“000“=col=“__“;row=“__“;when“001“=col=“__“;row=“__“;when“010“=col=“__“;row=“__“;when“011“=col=“__“;row=“__“;when“100“=col=“__“;row=“__“;whenothers=col=“__“;row=“__“;endcase;whens4=casenumiswhen“000“=col=“__“;row=“__“;when“001“=col=“__“;row=“__“;when“010“=col=“__“;row=“__“;when“011“=col=“__“;row=“__“;when“100“=col=“__“;row=“__“;whenothers=col=“__“;row=“__“;endcase;whens3=casenumiswhen“000“=col=“__“;row=“__“;when“001“=col=“__“;row=“__“;when“010“=col=“__“;row=“__“;when“011“=col=“__“;row=“__“;when“100“=col=“__“;row=“__“;whenothers=col=“__“;row=“__“;endcase;whens2=casenumiswhen“000“=col=“__“;row=“__“;when“001“=col=“__“;row=“__“;when“010“=col=“__“;row=“__“;when“011“=col=“__“;row=“__“;when“100“=col=“__“;row=“__“;whenothers=col=“__“;row=“__“;endcase;whens1=casenumiswhen“000“=col=“__“;row=“__“;when“001“=col=“__“;row=“__“;when“010“=col=“__“;row=“__“;when“011“=col=“__“;row=“__“;when“100“=col=“__“;row=“__“;whenothers=col=“__“;row=“__“;endcase;whens0=casenumiswhen“000“=col=“__“;row=“__“;when“001“=col=“__“;row=“__“;when“010“=col=“__“;row=“__“;when“011“=col=“__“;row=“__“;when“100“=col=“__“;row=“__“;whenothers=col=“__“;row=“__“;endcase;whenothers=casenumiswhen“000“=col=“__“;row=“__“;when“001“=col=“__“;row=“__“;when“010“=col=“__“;row=“__“;when“011“=col=“__“;row=“__“;when“100“=col=“__“;row=“__“;whenothers=col=“__“;row=“__“;endcase;endcase;endif;endif;endprocessp3;p4:process(clk_1)beginifreset='1'thenpresent_state=s10;start='0';elseifclk_1'eventandclk_1='1'thencasepresent_stateiswhens10=present_statestart='0';whens9=present_statestart='0';whens8=present_statestart='0';whens7=present_statestart='0';whens6=present_statestart='0';whens5=present_statestart='0';whens4=present_statestart='0';whens3=present_statestart='0';whens2=present_statestart='0';whens1=present_statestart='1';whens0=present_state=present_state;whenothers=null;start='1';endcase;endif;endif;endprocessp4;endbody_daojishi;libraryIEEE;useIEEE.std_logic_1164.all;useIEEE.std_logic_unsigned.all;entitydecodeisport(clk_in:instd_logic;__1MHzrecord1,record2:instd_logic_vector(1downto0);__比分狀態(tài)輸入lights:instd_logic_vector(2downto0);__繩子狀態(tài)輸入led:outstd_logic_vector(7downto0);__繩子解碼后輸出q:bufferstd_logic_vector(5downto0);__數(shù)碼管控制cats:outstd_logic_vector(6downto0));__數(shù)碼管顯示enddecode;architecturebody_decodeofdecodeissignaltmp_led:std_logic_vector(7downto0);__繩子輸出signaltmp_da1:std_logic_vector(6downto0);__比分1signaltmp_da2:std_logic_vector(6downto0);__比分2signaltmp:std_logic_vector(6downto0);__比分顯示beginled=tmp_led;cats=tmp;process(clk_in,lights,record1,record2,q,tmp_da2,tmp_da1,tmp)begincaselightsis__繩子狀態(tài)when“100“=tmp_led=“__“;when“011“=tmp_led=“__“;when“010“=tmp_led=“__“;when“001“=tmp_led=“__“;when“101“=tmp_led=“__“;when“110“=tmp_led=“__“;when“111“=tmp_led=“__“;whenothers=tmp_led=“__“;endcase;caserecord1is__比分狀態(tài)when“00“=tmp_da1=“__“;when“01“=tmp_da1=“__“;when“10“=tmp_da1=“__“;when“11“=tmp_da1=“__“;endcase;caserecord2is__比分狀態(tài)
溫馨提示
- 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)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度麻醉師醫(yī)療事故處理與賠償合同4篇
- 二零二五年度環(huán)保項(xiàng)目竣工驗(yàn)收質(zhì)量監(jiān)管合同2篇
- 藥源基地合作協(xié)議
- 合金鑄球段項(xiàng)目融資渠道探索
- 二零二五年度集裝箱碼頭裝卸服務(wù)租賃合同3篇
- 2025版女方離婚上訴狀:離婚后財產(chǎn)分割與子女撫養(yǎng)費(fèi)用分擔(dān)合同-@-1
- 二零二五年度酒店式公寓租賃代理服務(wù)協(xié)議2篇
- 2025至2030年中國紡織機(jī)械鏈條數(shù)據(jù)監(jiān)測研究報告
- 2025至2030年中國粗脂酸數(shù)據(jù)監(jiān)測研究報告
- 二零二五年文化產(chǎn)業(yè)發(fā)展有限責(zé)任公司股權(quán)收購協(xié)議書3篇
- 第十一章《功和機(jī)械能》達(dá)標(biāo)測試卷(含答案)2024-2025學(xué)年度人教版物理八年級下冊
- 2025年銷售部年度工作計(jì)劃
- 2024年蘇州工業(yè)園區(qū)服務(wù)外包職業(yè)學(xué)院高職單招職業(yè)適應(yīng)性測試歷年參考題庫含答案解析
- ESG表現(xiàn)對企業(yè)財務(wù)績效的影響研究
- DB3713T 340-2024 實(shí)景三維數(shù)據(jù)接口及服務(wù)發(fā)布技術(shù)規(guī)范
- 八年級生物開學(xué)摸底考(長沙專用)(考試版)
- (工作規(guī)范)公路預(yù)防性養(yǎng)護(hù)工作手冊
- 車間空調(diào)崗位送風(fēng)方案
- 使用錯誤評估報告(可用性工程)模版
- 初一年級班主任上學(xué)期工作總結(jié)
- 2023-2024年同等學(xué)力經(jīng)濟(jì)學(xué)綜合真題及參考答案
評論
0/150
提交評論