版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、課程設計報告電子搶答器設計 課程:可編程器件及應用課程設計班級: 2012142216姓名:曹勤 陳有玲 陳淑媛指導教師: 黃林2014年 11月 20日目 錄1課題背景 - 31.1 設計的目的 -31.2 系統(tǒng)功能及要求 -32程序功能模塊組成及流程圖 -4 2.1 程序功能模塊組成-4 2.2 程序流程圖-43程序代碼及模塊分析 -44運行結果-125實驗現(xiàn)象-166總結與體會 -18 1課題背景EDA及電子設計自動化,是指使用計算機自動完成電子系統(tǒng)的設計,應用EDA技術進行電子產品的設計已成為當今電子工程師的一項基本技。隨著電子技術和計算機技術的飛速發(fā)展,新的高度集成的電子設計方法不斷
2、推出,電子產品的性能越來越高,更新的速度也越來越快,與此同時,市場對電子產品的設計提出了更為嚴格的要求,從而促進了電子設計自動化(EDA)技術的迅速發(fā)展在多項競賽及節(jié)目上都用到電子搶答器,他們搶答所使用的搶答器就是我這次要做的課程設計的內容。有了搶答器會使選手間更加公平、公正、公開,也方便了主持人對現(xiàn)場的主持。1.1設計的目的本次課程設計的目的是在學習完EDA課程的基礎上,運用EDA的知識即VHDL語言,編寫程序來實現(xiàn)此次我設計的電子搶答器所要實現(xiàn)的功能,不僅會編寫程序,還要能夠在實驗室中檢測我所編寫的程序是否能夠達到預期的目的。1.2系統(tǒng)功能及要求(1)優(yōu)先編碼器電路立即分辨出搶答者編號,并
3、由鎖存器進行鎖存,然后由譯碼顯示電路顯示編號;(2)揚聲器發(fā)出短暫聲響,提醒主持人注意;(3)控制電路要對輸入編碼電路進行封鎖,避免其他選手再次進行搶答;(4)當選手將問題回答完畢,主持人操作計分開關,計分電路采用十進制加/減計數(shù)器、數(shù)碼管顯示。本輪搶答完畢,主持人操作控制開關,使系統(tǒng)回復到禁止工作狀態(tài),以便進行下一輪搶答。2程序功能模塊組成及流程圖2.1程序功能模塊組成本程序主要設計了七個模塊,分別是: 1.搶答鑒別模塊 2.計時模塊 3.數(shù)據(jù)選擇模塊 4.報警模塊 5.譯碼模塊 6.計分模塊 7.控制模塊2.2程序流程圖鑒別計時控制數(shù)據(jù)選擇報警譯碼計分主持人選手顯示3.程序代碼及模塊分析3
4、.1搶答鑒別模塊鑒別鎖存模塊的關鍵是準確判斷出第一搶答者并將其鎖存,實現(xiàn)的方法可使用觸發(fā)器或鎖存器,在得到第一信號后將輸入封鎖,使其它組的搶答信號無效。形成第一搶答信號后,用編碼、譯碼及數(shù)碼顯示電路顯示第一搶答者的組號并啟動答題計時電路。搶答鑒別電路可以由VHDL程序來實現(xiàn),以下是一斷搶答鑒別的VHDL程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity identify is port(ret,clk:in std_logic; a0,a1,a2,a3:in std_logic;
5、states:buffer std_logic_vector(3 downto 0); tmp:out std_logic);end identify;architecture behav of identify issignal st:std_logic_vector(3 downto 0);beginprocess(clk , ret,a0, a1,a2,a3)beginif ret='1' then tmp<='0'st<="0000"elsif clk'event and clk='1' theni
6、f (a0='1' or st(0)='1')and not( st(1)='1' or st(2)='1' or st(3)='1' ) then st(0)<='1'end if ;if (a1='1' or st(1)='1')and not( st(0)='1' or st(2)='1' or st(3)='1' ) then st(1)<='1'end if ;if (a2='
7、;1' or st(2)='1')and not( st(0)='1' or st(1)='1' or st(3)='1' ) then st(2)<='1'end if ; if (a3='1' or st(3)='1')and not( st(0)='1' or st(1)='1' or st(2)='1' ) then st(3)<='1'end if ;tmp<=st(0) or st(
8、1) or st(2) or st(3);end if ;end process;process(states(0),states(1),states(2),states(3)beginif (st="0000") then states<="0000" elsif (st<="0001") then states<="0001"elsif (st<="0010") then states<="0010" elsif (st<="
9、0100") then states<="0011"elsif (st<="1000") then states<="0100" end if; end process;end behav;3.2計時模塊搶答計時模塊的任務是當主持人啟動這個計時開關時開始計時,如果在規(guī)定的時間內答完題則答題有效,如果在規(guī)定的時間內沒有完成,則答題無效。計時器從規(guī)定的時間倒計時,計時為零時計時結束。答題有無效作憑主持人來判斷。計時電路可以由VHDL程序來實現(xiàn),以下是一段計時的VHDL程序:library ieee;use ie
10、ee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity timed isport(clk,ret,sin:in std_logic;time1,time2:buffer std_logic_vector(3 downto 0);warningg:out std_logic);end timed ;architecture behav of timed issignal co:std_logic;beginprocess(clk,ret,sin,time1)beginif ret='1' thentime1<
11、="0000"elsif clk'event and clk1='1' thenco<='0'if sin='1' then if time1="0000" thentime1<="1001"co<='1'else time1<=time1-1; end if; end if;end if;end process ;process(co,ret,sin,time2)beginif ret='1' thentime2<=
12、"0010"elsif co'event and co='1' thenif sin='1' thenif time2="0000" then time2<="0010" else timee2<=time2-1;end if;end if;end if; if(time1="0000" and time2="0000") thenwarning<='1'else warning<='0'end if
13、;end process;end behav;3.3數(shù)據(jù)選擇模塊輸入三路信號,上升沿到來時count加一,當count=“00“時,選擇in1路信;當count=“01“時,選擇in2路信號;當count=“10“時,選擇c路信號;等于其他信號時無操作。數(shù)據(jù)選擇電路可以由VHDL程序來實現(xiàn),以下是一段數(shù)據(jù)選擇的VHDL程序: library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity selecte is port (in1,in2,in
14、3: in std_logic_vector(3 downto 0); clk,ret: in std_logic; s: out std_logic_vector(1 downto 0); y: out std_logic_vector(3 downto 0) );end selecte;architecture behav of selecte is signal count: std_logic_vector (1 downto 0); begin s<=count;process(clk,ret) begin if(ret='1')then count<=&
15、quot;00" elsif(clk'event and clk='1')then if(count>="10")then count<="00" else count<=count+1; end if; end if; case count is when "00"=>y<=in1; when "01"=>y<=in2; when "10"=>y<=in3; when others=>null; en
16、d case; end process;end behav;3.4報警模塊當輸入信號無效或超時時就啟動報警模塊計。報警電路可以由VHDL程序來實現(xiàn),以下是一段報警的VHDL程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity reporte isport(clk,l:in std_logic; q:out std_logic);end reporte;architecture behav of reporte is begin process(l,clk) begin if l=
17、39;0' then q <='0' elsif l='1' then q<=clk; end if;end process;end behav;3.5譯碼模塊搶答成功后輸出選手組號。譯碼電路可以由VHDL程序來實現(xiàn),以下是一段譯碼的VHDL程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity translate is port(din: in std_logic_vector(3 downto 0); dout: out std_
18、logic_vector(6 downto 0);end translate;architecture behav of translate is begin process(din) begin case din is when "0000"=>dout<="1111110" -0 when "0001"=>dout<="0110000" -1 when "0010"=>dout<="1101101" -2 when "0011
19、"=>dout<="1111001" -3 when "0100"=>dout<="0110011" -4 when "0101"=>dout<="1011011" -5 when "0110"=>dout<="1011111" -6 when "0111"=>dout<="1110000" -7 when "1000"=>
20、;dout<="1111111" -8 when "1001"=>dout<="1111011" -9 when others=>dout<="0000000" end case; end process;end behav;3.6計分模塊當選手回答完畢后,主持人判斷是否正確,酌情加分,若回答正確,加一分,否則不加分,也不減分。計分電路可以由VHDL程序來實現(xiàn),以下是一段計分的VHDL程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity jf isport(q:in bit; count:out std_logic_vector(3 downto 0);end jf;architecture behav of jf is signal temp:std_logic_vector(3 downto 0):="0000"beginprocess(q)beginif(q='1')then temp<=temp+1;end if;end
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度人工智能教育培訓項目融資擔保借款合同4篇
- 二零二五年度存量房屋交易產權過戶指導合同2篇
- 2025年度農業(yè)信息化建設服務合同4篇
- 二零二五年度農機配件質量檢測與評估服務合同4篇
- 2025年度路面混凝土施工進度管理合同范本4篇
- 二零二五年度新能源汽車貸款抵押合同示范文本4篇
- 2025年度綠色環(huán)保廚房裝修改造一體化服務合同4篇
- 2025年度戶外廣告場地租賃及廣告投放合同4篇
- 2025年船舶建造項目合同管理協(xié)議3篇
- 2025年度海外投資風險控制及合同保障協(xié)議4篇
- 湖北省黃石市陽新縣2024-2025學年八年級上學期數(shù)學期末考試題 含答案
- 硝化棉是天然纖維素硝化棉制造行業(yè)分析報告
- 央視網(wǎng)2025亞冬會營銷方案
- 《00541語言學概論》自考復習題庫(含答案)
- 《無砟軌道施工與組織》 課件 第十講雙塊式無砟軌道施工工藝
- 江蘇省南京市、鹽城市2023-2024學年高三上學期期末調研測試+英語+ 含答案
- 2024新版《藥品管理法》培訓課件
- 《阻燃材料與技術》課件 第7講 阻燃橡膠材料
- 爆炸物運輸安全保障方案
- 江蘇省南京市2025屆高三學業(yè)水平調研考試數(shù)學試卷(解析版)
- 2024年黑龍江省哈爾濱市中考數(shù)學試卷(附答案)
評論
0/150
提交評論