eda課程設(shè)計(jì)電子搖獎(jiǎng)器_第1頁
eda課程設(shè)計(jì)電子搖獎(jiǎng)器_第2頁
eda課程設(shè)計(jì)電子搖獎(jiǎng)器_第3頁
eda課程設(shè)計(jì)電子搖獎(jiǎng)器_第4頁
eda課程設(shè)計(jì)電子搖獎(jiǎng)器_第5頁
已閱讀5頁,還剩9頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、電 子 課 程 設(shè) 計(jì) 電子搖獎(jiǎng)器 學(xué) 院 班 級 姓 名 學(xué) 號 指導(dǎo)老師 2009年12目錄一 設(shè)計(jì)任務(wù)與要求-二 總體框圖-三 器件選擇- 四 功能模塊-五 總體設(shè)計(jì)圖-電子搖獎(jiǎng)器一、 設(shè)計(jì)任務(wù)與要求 1、電子搖獎(jiǎng)器能隨機(jī)的產(chǎn)生6位號碼,并顯示在七段數(shù)碼管上;2、設(shè)有“起始”,“停止”和“復(fù)位”鍵。按起始鍵,數(shù)碼開始滾動,且速度較快,按停止鍵停止,按復(fù)位鍵后,6位數(shù)為全0;3、6位號碼沒有相關(guān)性,互相獨(dú)立。二、總體框圖 數(shù)碼管計(jì)數(shù)器譯碼器 掃 描 分頻器鎖存器 設(shè)計(jì)思路:根據(jù)題目要求“能隨即產(chǎn)生6位號碼,并顯示在七段數(shù)碼管上”想到需要設(shè)計(jì)一個(gè)6位數(shù)碼掃描顯示電路,其中每個(gè)數(shù)碼管的7個(gè)段g

2、,f,e,d,c,b,a都分別連在一起,6個(gè)數(shù)碼管分別由6個(gè)選通信號k1到k6來選擇,被選通的數(shù)碼管顯示數(shù)據(jù),其余關(guān)閉。在此使用3-8譯碼器來完成選擇功能。如在某一時(shí),k1為高電平,其余選通信號為低電平,這是僅k1對應(yīng)的數(shù)碼管顯示來自段信號端的數(shù)據(jù),而其它5個(gè)數(shù)碼管呈現(xiàn)關(guān)閉狀態(tài)。根據(jù)這種電路情況,如果希望在6個(gè)數(shù)碼管顯示希望的數(shù)據(jù),就必須使得6個(gè)選通信號k1到k6分別被單獨(dú)選通,與此同時(shí),在斷信號輸入口加上希望在該對應(yīng)數(shù)碼管上顯示的數(shù)據(jù),于是隨著選通信號的掃描,就能實(shí)現(xiàn)掃描顯示的目的。將50mhz的頻率經(jīng)分頻器(div)2500分頻得10000hz加在掃描器(seltime)上,此為掃描器的掃

3、描頻率。掃描器的輸入端接6個(gè)鎖存器(reg4b),鎖存住所需數(shù)字以便能夠顯示,鎖存器的輸入端接6個(gè)十進(jìn)制計(jì)數(shù)器(cnt10),將6個(gè)計(jì)數(shù)器串聯(lián)起來,構(gòu)成10*10*10*10*10*10的計(jì)數(shù)器。由于題目要求“設(shè)有起始。停止復(fù)位鍵”,所以將十進(jìn)制計(jì)數(shù)器的使能端作為開始與停止鍵。使能端為高電平1時(shí)計(jì)數(shù)器開始計(jì)數(shù)即開始,使能端為低電平0時(shí)停止計(jì)數(shù)即停止。同時(shí)計(jì)數(shù)器的置位端設(shè)為清零端即復(fù)位。給計(jì)數(shù)器的時(shí)鐘端加高50mhz的頻率,在時(shí)鐘上升沿到來的時(shí)候計(jì)數(shù)器計(jì)數(shù),時(shí)鐘下降沿到來的時(shí)候鎖存器將所計(jì)數(shù)鎖存。因此當(dāng)按開始鍵時(shí)數(shù)碼管上數(shù)字開始滾動,且速度較快,按停止鍵的時(shí)停止計(jì)數(shù),并在數(shù)碼管上顯示所寄存數(shù)字,

4、按復(fù)位鍵后,6位數(shù)為全0.三、選擇器件1、裝有quartusii軟件的計(jì)算機(jī)一臺。2、芯片:使用altera公司生產(chǎn)的cyclone系列芯片,如ep1c12q240c8芯片。3、eda實(shí)驗(yàn)箱一個(gè)。4、下載接口是數(shù)字芯片的下載接口(jtag)主要用于fpga芯片的數(shù)據(jù)下載。5、撥碼開關(guān)。6、時(shí)鐘源。cyclone器件的配置器件。圖一 cyclone的配置器件 配置器件器件數(shù)量ep1c3ep1c4ep1c6ep1c12ep1c20epcs1111n/a n/aepcs411111epc2 11122epc411111epc811111epc1611111此次設(shè)計(jì)實(shí)驗(yàn)采用altera公司的

5、cyclone系列的fpga芯片ep1c12,設(shè)計(jì)和仿真采用altera公司的quartus ii軟件,ep1c12各項(xiàng)參數(shù)參照上表。 cyclone的性能特性1、新的可編程體系結(jié)構(gòu),實(shí)現(xiàn)低成本設(shè)計(jì)。 2、嵌入式存儲器資源支持多種存儲器應(yīng)用和數(shù)字信號處理(dsp)實(shí)現(xiàn) 3、專用外部存儲器接口電路,支持與ddr fcram和sdram器件以及sdr sdram存儲器的連接。 4、支持串行總線和網(wǎng)絡(luò)接口以及多種通信協(xié)議 片內(nèi)和片外系統(tǒng)時(shí)序管理使用嵌入式pll 5、支持單端i/o標(biāo)準(zhǔn)和差分i/o技術(shù),lvds信號數(shù)據(jù)速率高達(dá)640mbps。 6、處理功耗支持nios ii 系列嵌入式處理器 7、采用

6、新的串行配置器件的低成本配置方案 8、quartus ii 軟件opencore評估特性支持免費(fèi)的ip功能評估 四、功能模塊1、3-8譯碼器模塊: 仿真波形:3-8譯碼器的功能表無論從邏輯圖還是功能表我們都可以看到74ls138的八個(gè)輸出管腳,任何時(shí)刻要么全為高電平1芯片處于不工作狀態(tài),要么只有一個(gè)為低電平0,其余7個(gè)輸出管腳全為高電平1。如果出現(xiàn)兩個(gè)輸出管腳在同一個(gè)時(shí)間為0的情況,說明該芯片已經(jīng)損壞。當(dāng)附加控制門的輸出為高電平(s1)時(shí),可由邏輯圖寫出由上式可以看出,在同一個(gè)時(shí)間又是這三個(gè)變量的全部最小項(xiàng)的譯碼輸出,所以也把這種譯碼器叫做最小項(xiàng)譯碼器。71ls138有三個(gè)附加的控制端、和。當(dāng)

7、、時(shí),輸出為高電平(s1),譯碼器處于工作狀態(tài)。否則,譯碼器被禁止,所有的輸出端被封鎖在高電平。附:3-8譯碼器vhdl程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity decode3_8 isport(sel:in std_logic_vector(2 downto 0);q:out std_logic_vector(7 downto 0);end decode3_8;architecture a of decode3_8 isbeginq<="11111110

8、"when sel=0 else"11111101"when sel=1 else"11111011"when sel=2 else"11110111"when sel=3 else"11101111"when sel=4 else"11011111"when sel=5 else"11111111"end a;2、十進(jìn)制計(jì)數(shù)器模塊: 十進(jìn)制計(jì)數(shù)器波形仿真圖: 附:十進(jìn)制計(jì)數(shù)器vhdl程序:library ieee;use ieee.std_logic_1164.a

9、ll;use ieee.std_logic_unsigned.all;entity cnt10 isport(clk,rst,ena:in std_logic; outy:out std_logic_vector(3 downto 0); cout:out std_logic);end cnt10;architecture one of cnt10 isbeginprocess(clk,rst,ena)variable cqi:std_logic_vector(3 downto 0):="0000"beginif rst='0'then cqi:=(othe

10、rs=>'0');elsif clk'event and clk='1'thenif ena='1'thenif cqi<9 then cqi:=cqi+1;else cqi:=(others=>'0');end if;end if;end if;if cqi=9 then cout<='1'else cout<='0'end if;outy<=cqi;end process;end one;3、寄存器模塊:寄存器波形仿真:寄存器vhdl程序:librar

11、y ieee;use ieee.std_logic_1164.all;entity reg4b isport(lk:in std_logic; din:in std_logic_vector(3 downto 0);rest:in std_logic;dout:out std_logic_vector(3 downto 0);end reg4b;architecture behav of reg4b isbeginprocess(lk,din,rest)beginif (rest='0') then dout<="0000"elsif lk'e

12、vent and lk='0' then dout<=din;-end if;end if;end process;end behav;4、七段數(shù)碼管模塊:七段數(shù)碼管模塊仿真波形:附:七段數(shù)碼管vhdl程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity deled is port(num:in std_logic_vector(3 downto 0); a:out std_logic; b:out std_logic; c:out std_logic; d:o

13、ut std_logic; e:out std_logic; f:out std_logic; g:out std_logic; dp:out std_logic);end deled;architecture fun of deled issignal led:std_logic_vector(6 downto 0);begin a<=led(6);b<=led(5);c<=led(4);d<=led(3);e<=led(2);f<=led(1);g<=led(0);dp<='0' led<="1111110&q

14、uot;when num="0000"else "0110000"when num="0001"else "1101101"when num="0010"else "1111001"when num="0011"else "0110011"when num="0100"else "1011011"when num="0101"else "1011111"wh

15、en num="0110"else "1110000"when num="0111"else "1111111"when num="1000"else "1111011"when num="1001"else "1110111"when num="1010"else "0011111"when num="1011"else "1001110"when num

16、="1100"else "0111101"when num="1101"else "1001111"when num="1110"else "1000111"when num="1111"end fun;5、掃描器模塊: 掃描器仿真波形:附:掃描器vhdl程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.a

17、ll;entity seltime1 isport( clk2:std_logic; dout1,dout2,dout3,dout4,dout5,dout6:in std_logic_vector(3 downto 0); daout:out std_logic_vector(3 downto 0); sel:out std_logic_vector(2 downto 0);end;architecture fun of seltime1 issignal count: std_logic_vector(2 downto 0);beginsel<=count;process(clk2)b

18、eginif(clk2'event and clk2='1')thenif(count>="110")thencount<="000"elsecount<=count+1;end if;end if;case count iswhen "000"=>daout<=dout6;when "001"=>daout<=dout5;when "010"=>daout<=dout4;when "011"=&g

19、t;daout<=dout3;when "100"=>daout<=dout2;when "101"=>daout<=dout1;when others=>daout<="0000"end case;end process;end fun;6、分頻器模塊:分頻器仿真波形:附:分頻器vhdl程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity div isport (clk: in s

20、td_logic; clkout: out std_logic);end div;architecture one of div is signal count: integer range 0 to 100000; signal tmp : std_logic; begin process(clk) begin if (clk'event and clk='1') then if count>99999 then count<=0 ; tmp<=not tmp; else count<=count+1; end if; end if;end process;clkout<=tmp;end one; 五、總體設(shè)計(jì)電路1、頂層電路原理圖2、電路的整體工作情況: 計(jì)數(shù)器部分(1)計(jì)數(shù)器部分由6個(gè)十進(jìn)制計(jì)數(shù)器組成,各級之間采用異步方式連接。各級計(jì)數(shù)器的rst端都與復(fù)位鍵相連,在復(fù)位端信號為低電平時(shí),計(jì)數(shù)器同時(shí)清零。各級ena端都與開始,停止鍵相連,當(dāng)使能端為高電平時(shí),開始計(jì)數(shù)。當(dāng)使能端為低電平時(shí),停止計(jì)數(shù)。(2)寄存器部分寄存器采用4個(gè)jk觸發(fā)器組成,時(shí)鐘端與計(jì)數(shù)的使能端相連,在時(shí)鐘下降沿時(shí),將計(jì)數(shù)

溫馨提示

  • 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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論