

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、<p><b> 課程設(shè)計(jì)說明書</b></p><p> 題目 8個LED循環(huán)顯示、計(jì)數(shù)器的設(shè)計(jì) </p><p> 起止日期 2009.12.18-2010.1.4 </p><p> 電子設(shè)計(jì)自動化設(shè)計(jì)任務(wù)書</p><p> 系(部):電子與通信工程系 專業(yè):電氣工程及其自動化
2、 指導(dǎo)教師:</p><p><b> 目錄</b></p><p> 課程設(shè)計(jì)目的 ……………………………………………………………… 5</p><p> 課程設(shè)計(jì)題目……………………………………………………………… 5</p><p> 設(shè)計(jì)內(nèi)容…………………………………………………………
3、………… 5</p><p> 3.1 設(shè)計(jì)思路 ……………………………………………………………… 5</p><p> 3.2 設(shè)計(jì)步驟 ……………………………………………………………… 5</p><p> 4、程序中各引腳的分配 ……………………………………………………… 12</p><p> 5、程序結(jié)
4、構(gòu)框圖………………………………………………………………… 13</p><p> 6、完整程序 …………………………………………………………………… 14</p><p> 7、課程設(shè)計(jì)總結(jié)……………………………………………………………… 21</p><p> 參考文獻(xiàn)……………………………………………………………………… 22<
5、/p><p><b> 課程設(shè)計(jì)目的</b></p><p> 系統(tǒng)提供一個50MHZ的時鐘,要求用VHDL語言設(shè)計(jì)一個8位計(jì)數(shù)器,同時有一個8位led循環(huán)顯示燈,當(dāng)燈亮一次,數(shù)碼管上就記一次數(shù)。通過做此計(jì)數(shù)器,知道分頻的概念,并且知道如何分頻,同時知道什么是數(shù)碼管的動態(tài)顯示,怎么做出數(shù)碼管的動態(tài)顯示。</p><p><b> 課
6、程設(shè)計(jì)題目</b></p><p> 8個LED循環(huán)顯示、計(jì)數(shù)器的設(shè)計(jì)。</p><p><b> 設(shè)計(jì)內(nèi)容</b></p><p><b> 設(shè)計(jì)思路:</b></p><p> 由于要設(shè)計(jì)一個8個led燈循環(huán)顯示的計(jì)數(shù)器。則重要的設(shè)計(jì)部分在于讓led燈循環(huán)顯示,同時在顯示的同
7、時數(shù)碼管的數(shù)加1;要讓led燈亮的同時,數(shù)碼管上面的數(shù)字加1,則需要在同一個脈沖下完成計(jì)數(shù)器加一,led等循環(huán)亮一位。</p><p> 由于系統(tǒng)給定的時鐘是50Mhz,顯然數(shù)碼管和led燈不能正常工作,這就涉及到要將50mhz頻率分頻,將頻率變小,使計(jì)數(shù)器和led燈能正常工作;</p><p> Led燈設(shè)計(jì)思路:led燈要實(shí)現(xiàn)循環(huán)顯示,即第一個燈亮之后,在出現(xiàn)一個上升沿脈沖后,第二
8、個燈亮,第一個燈滅,來一個脈沖移動一個,并實(shí)現(xiàn)循環(huán),為了實(shí)現(xiàn)循環(huán),設(shè)計(jì)思路是講來一次脈沖將最高位補(bǔ)到最低位,次最高位變成最高位。</p><p> 數(shù)碼管的設(shè)計(jì)思路:由于數(shù)碼管要求是動態(tài)顯示,顯然還要分出一個置位工作掃描頻率,由于人的視覺暫留,頻率應(yīng)該大于24hz,為了數(shù)碼管顯示效果,我分出了1000hz的頻率來掃描8位數(shù)碼管的工作。</p><p> 分頻的設(shè)計(jì)思路:分頻是為了將50
9、mhz的頻率減小,即在50mhz(clk)出現(xiàn)n個上升沿之前另一個clk1不翻轉(zhuǎn),而在n個上升沿時翻轉(zhuǎn),在2n之前一直保持翻轉(zhuǎn)后的狀態(tài),到2n時,計(jì)數(shù)器清零,同時再實(shí)現(xiàn)翻轉(zhuǎn),這樣就能做出任意較小的頻率實(shí)現(xiàn)設(shè)計(jì)。</p><p><b> 2、設(shè)計(jì)步驟:</b></p><p> 首先設(shè)計(jì)分頻計(jì)數(shù)器,由于要有一個數(shù)碼管置位工作掃描頻率,還要有一個實(shí)現(xiàn)計(jì)數(shù)個和led燈
10、循環(huán)顯示的頻率,即分頻要分出兩個不同的頻率:</p><p><b> 分頻程序入下:</b></p><p> process(clk)</p><p> variable cout:integer:=0;</p><p><b> begin </b></p><p&
11、gt; IF clk'event and clk='1' then</p><p> cout:=cout+1;</p><p> if cout<=25000 then clk1<='0';</p><p> elsif cout<50000 then clk1<='1';&l
12、t;/p><p> else cout:=0;</p><p><b> end if; </b></p><p><b> end if; </b></p><p> end process; </p><p> process(clk)</p>&l
13、t;p> variable cout:integer:=0;</p><p><b> BEGIN</b></p><p> IF clk'event and clk='1' then</p><p> cout:=cout+1;</p><p> IF cout<=1250
14、000 then clk2<='0';</p><p> elsif cout<25000000 then clk2<='1';</p><p> else cout:=0;</p><p><b> end if; </b></p><p> 在進(jìn)程中,clk
15、為原始頻率50mhz,以上兩個進(jìn)程是為了分出2hz頻率和1000hz頻率,其中count是進(jìn)程中的一個變量,用來出現(xiàn)上升沿脈沖計(jì)數(shù)。其中clk1是分出來的1000hz;頻率,clk2是分出來的2hz的led燈移動和數(shù)碼管計(jì)數(shù)的頻率;</p><p> 在頻率分出來后,就可以設(shè)計(jì)led燈的循環(huán)顯示了,led燈循環(huán)顯示的程序如下:</p><p> process(rst,start,cl
16、k2)</p><p> variable reg8:std_logic_vector(7 downto 0);</p><p> variable fg:integer:=1;</p><p><b> begin</b></p><p> if rst='1' then</p>
17、<p> reg8:=(others=>'1');</p><p><b> fg:=1;</b></p><p> elsif clk2'event and clk2='1' then</p><p> if start='1' then</p>
18、<p> if fg=1 then reg8:="11111110";</p><p><b> fg:=0;</b></p><p> else reg8:=reg8(6 downto 0)®8(7);</p><p><b> end if;</b></p>
19、;<p><b> end if;</b></p><p><b> end if;</b></p><p> din8<=reg8;</p><p> end process;</p><p> 程序中,rst是復(fù)位信號,功能是在在出現(xiàn)rst=1是,將led回到最初始
20、狀態(tài),從程序中看是燈全滅掉,當(dāng)rst=0是,回復(fù)循環(huán)顯示;start是一個開始信號,只有start=1是,計(jì)數(shù)才開始工作;din8是一個八位的二進(jìn)制數(shù),在硬件上直接和8個led燈連接;fg是設(shè)計(jì)的一個標(biāo)志位,目的是為了在開始來第一個脈沖時,使第一個led燈變亮,并將fg賦值為零,來第二個脈沖時,就開始循環(huán);</p><p> 當(dāng)rst=0并且start=1時,Led的波形圖如下:</p><
21、p> 從圖中看出,在rst為0,start為1時,則led燈的顯示就會出現(xiàn)出現(xiàn)循環(huán)顯示,din由11111110到01111111,之后又回到11111110開始循環(huán);</p><p> 在rst=1是,將會復(fù)位,即din=“11111111”,波形如下:</p><p> 從圖中明顯能看出,在rst為1時,本該進(jìn)行循環(huán)的程序在rst=1時,將使din全部置一了,即實(shí)現(xiàn)你rst
22、的功能。</p><p> 在做start的功能時,start的功能是,在rst=0,start=1時,將會做led燈的循環(huán),在rst=0,start=1時,將使其暫停循環(huán)功能,并保持當(dāng)前狀態(tài)不變,波形圖如下:</p><p> 如圖所示,在start=0時,din就停留在11110111,此二進(jìn)制數(shù)正好十進(jìn)制是239,一直保持此狀態(tài),在start=1是,則開始循環(huán)的工作。</p
23、><p> 做完以上程序的設(shè)計(jì),即要實(shí)現(xiàn)數(shù)碼管的動態(tài)顯示,首先要做的就是數(shù)碼管的動態(tài)顯示,即要不間斷的掃面8個數(shù)碼管的工作位,掃描置位程序如下:</p><p> process(clk1)</p><p><b> begin</b></p><p> if clk1'event and clk1='
24、;1' then</p><p> if wei=7 then wei<="000";</p><p> else wei<=wei+1;</p><p><b> end if;</b></p><p><b> end if;</b></p&
25、gt;<p> end process;</p><p> process(wei)</p><p><b> begin</b></p><p> case wei is</p><p> when "000" => selout<="00000001&
26、quot;;</p><p> when "001" => selout<="00000010";</p><p> when "010" => selout<="00000100";</p><p> when "011" =>
27、selout<="00001000";</p><p> when "100" => selout<="00010000";</p><p> when "101" => selout<="00100000";</p><p> w
28、hen "110" => selout<="01000000";</p><p> when "111" => selout<="10000000";</p><p> when others=>null;</p><p><b> end
29、case;</b></p><p> end process;</p><p> clk1是分出來的1khz頻率,wei是設(shè)置的一個三位二進(jìn)制數(shù),從000-111,每一個狀態(tài)都是置一個數(shù)碼管工作,selout是一個7位二進(jìn)制數(shù),是個硬件上數(shù)碼管的工作位一一對應(yīng)。</p><p> 在做好置位后,余下的就是數(shù)碼管顯示計(jì)數(shù)的問題了,數(shù)碼管顯示的是一個8
30、位十進(jìn)制的數(shù),功能能實(shí)現(xiàn)進(jìn)位,數(shù)碼管計(jì)數(shù)的程序如下:</p><p> process(rst,start,clk2)</p><p> variable ao0:std_logic_vector(3 downto 0);</p><p> variable ao1:std_logic_vector(3 downto 0);</p><p&
31、gt; variable ao2:std_logic_vector(3 downto 0);</p><p> variable ao3:std_logic_vector(3 downto 0);</p><p> variable ao4:std_logic_vector(3 downto 0);</p><p> variable ao5:std_log
32、ic_vector(3 downto 0);</p><p> variable ao6:std_logic_vector(3 downto 0);</p><p> variable ao7:std_logic_vector(3 downto 0);</p><p><b> begin</b></p><p>
33、 if rst='1' then </p><p> ao0:=(others=>'0');</p><p> ao1:=(others=>'0');</p><p> ao2:=(others=>'0');</p><p> ao3:=(others
34、=>'0');</p><p> ao4:=(others=>'0');</p><p> ao5:=(others=>'0');</p><p> ao6:=(others=>'0'); </p><p> ao7:=(others=>
35、39;0');</p><p> elsif clk2'event and clk2='1' then</p><p> if start='1' then</p><p> if ao0<=9 then</p><p> ao0:=ao0+1;</p><p&
36、gt;<b> end if;</b></p><p> if ao0>9 then</p><p> if ao1=9 and ao2=9 and ao3=9 and ao4=9 and ao5=9 and ao6=9 and ao7=9 then</p><p> ao0:=(others=>'0');
37、</p><p> ao1:=(others=>'0');</p><p> ao2:=(others=>'0');</p><p> ao3:=(others=>'0');</p><p> ao4:=(others=>'0');</p&g
38、t;<p> ao5:=(others=>'0');</p><p> ao6:=(others=>'0');</p><p> ao7:=(others=>'0'); </p><p> else null;</p><p><b> end
39、 if; </b></p><p> if ao0>9 then </p><p> if ao1=9 and ao2=9 and ao3=9 and ao4=9 and ao5=9 and ao6=9 then</p><p> ao7:=ao7+1;</p><p> ao0:=(others=>
40、'0');</p><p> ao1:=(others=>'0');</p><p> ao2:=(others=>'0');</p><p> ao3:=(others=>'0');</p><p> ao4:=(others=>'0
41、39;);</p><p> ao5:=(others=>'0');</p><p> ao6:=(others=>'0');</p><p> else null;</p><p><b> end if;</b></p><p><b&
42、gt; end if;</b></p><p> if ao0>9 then</p><p> if ao1=9 and ao2=9 and ao3=9 and ao4=9 and ao5=9 then </p><p> ao6:=ao6+1;</p><p> ao0:=(others=>'0&
43、#39;);</p><p> ao1:=(others=>'0');</p><p> ao2:=(others=>'0');</p><p> ao3:=(others=>'0');</p><p> ao4:=(others=>'0');&l
44、t;/p><p> ao5:=(others=>'0');</p><p> else null;</p><p><b> end if;</b></p><p><b> end if;</b></p><p> if ao0>9 the
45、n</p><p> if ao1=9 and ao2=9 and ao3=9 and ao4=9 then</p><p> ao5:=ao5+1;</p><p> ao0:=(others=>'0');</p><p> ao1:=(others=>'0');</p>
46、<p> ao2:=(others=>'0');</p><p> ao3:=(others=>'0');</p><p> ao4:=(others=>'0');</p><p> else null;</p><p><b> end if;&
47、lt;/b></p><p><b> end if;</b></p><p> if ao0>9 then</p><p> if ao1=9 and ao2=9 and ao3=9 then</p><p> ao4:=ao4+1; </p><p> ao0:=(
48、others=>'0');</p><p> ao1:=(others=>'0');</p><p> ao2:=(others=>'0');</p><p> ao3:=(others=>'0');</p><p> else null;<
49、/p><p><b> end if;</b></p><p><b> end if;</b></p><p> if ao0>9 then</p><p> if ao1=9 and ao2=9 then</p><p> ao3:=ao3+1;</p
50、><p> ao0:=(others=>'0');</p><p> ao1:=(others=>'0');</p><p> ao2:=(others=>'0');</p><p> else null;</p><p><b> en
51、d if;</b></p><p><b> end if;</b></p><p> if ao0>9 then</p><p> if ao1=9 then</p><p> ao2:=ao2+1;</p><p> ao0:=(others=>'0&
52、#39;);</p><p> ao1:=(others=>'0');</p><p> else ao1:=ao1+1;</p><p> ao0:=(others=>'0');</p><p> end if; </p><p> end if; &
53、lt;/p><p><b> end if;</b></p><p><b> end if;</b></p><p><b> end if;</b></p><p><b> co0<=ao0;</b></p><p>
54、;<b> co1<=ao1;</b></p><p><b> co2<=ao2;</b></p><p><b> co3<=ao3;</b></p><p><b> co4<=ao4;</b></p><p><
55、;b> co5<=ao5;</b></p><p><b> co6<=ao6;</b></p><p><b> co7<=ao7;</b></p><p> end process;</p><p> 程序中co0-co7是對應(yīng)數(shù)碼管上從低位到高位的
56、十進(jìn)制數(shù),ao0-ao7是程序中定義的中間變量;程序中的rst是復(fù)位信號,start是開始信號,在此的rst和start和led循環(huán)顯示中的rst和start是同一信號,這樣才能讓led燈和數(shù)碼管同步工作;</p><p> 計(jì)數(shù)器的波形顯示如下:</p><p> 由上圖看出,在start=1 并且rst=0時,在出現(xiàn)上升沿時,co0加1,當(dāng)co0到9時,在下一個上升沿將產(chǎn)生進(jìn)位,使
57、co1變成1,co0變成0。</p><p> 在rst=1時,將產(chǎn)生復(fù)位,致使co0-co7全部置0,由波形可得:</p><p> 顯然,當(dāng)產(chǎn)生復(fù)位信號時,全部置零了,說明程序的設(shè)計(jì)能達(dá)到預(yù)先設(shè)計(jì)的效果。</p><p> 在rst=0,start=0時,根據(jù)設(shè)計(jì),應(yīng)該是數(shù)碼管的數(shù)應(yīng)該保持現(xiàn)有的狀態(tài)不變,并且在start=1后,應(yīng)該能繼續(xù)計(jì)數(shù),實(shí)際波形如下
58、:</p><p> 由圖可以得出,在rst=0 并且start=0是,co1=5,co0=3,之后,在start=1時,繼續(xù)開始了計(jì)數(shù),說明實(shí)現(xiàn)設(shè)計(jì)的能滿足設(shè)計(jì)要求。</p><p> 最后一部分就是做出數(shù)碼管顯示十進(jìn)制數(shù),由于每個數(shù)碼管的顯示都基本一樣,就只有選擇數(shù)碼管的條件不同,在此只寫出一個數(shù)碼管的顯示程序:</p><p> process(wei,
59、co0,co1,co2,co3,co4,co5,co6,co7)</p><p><b> begin</b></p><p> if wei="000" then</p><p> case co0 is</p><p> when "0000" => led7s1
60、<="1000000";</p><p> when "0001" => led7s1<="1111001";</p><p> when "0010" => led7s1<="0100100";</p><p> when &qu
61、ot;0011" => led7s1<="0110000";</p><p> when "0100" => led7s1<="0011001";</p><p> when "0101" => led7s1<="0010010";</
62、p><p> when "0110" => led7s1<="0000010";</p><p> when "0111" => led7s1<="1111000";</p><p> when "1000" => led7s1<
63、="0000000";</p><p> when "1001" => led7s1<="0010000";</p><p> when others=> null;</p><p><b> end case;</b></p><p>
64、<b> end if;</b></p><p> end process;</p><p> 在wei=“000”時,將執(zhí)行由co0的狀態(tài)來顯示個位上的數(shù),co0-co9對應(yīng)顯示十進(jìn)制數(shù)上的0-9;led7s1是一個七位二進(jìn)制數(shù),從低位到高位分別對應(yīng)數(shù)碼管的a,b,c,d,e,f,g管腳;十位,千位,萬位等等的顯示皆如此。</p><p&g
65、t; 四、程序中各引腳的分配如下:</p><p><b> 五、程序結(jié)構(gòu)框圖:</b></p><p> 完整的程序如下:library ieee; </p><p> use ieee.std_logic_1164.all; </p><p> use ieee.std_logic_unsigned.all
66、;</p><p> entity jishu is</p><p> port(clk,rst,start:in std_logic;</p><p> din8:out std_logic_vector(7 downto 0);</p><p> selout:out std_logic_vector(7 downto 0);&l
67、t;/p><p> led7s1:out std_logic_vector(6 downto 0));</p><p><b> end;</b></p><p> architecture one of jishu is</p><p> signal clk1,clk2:std_logic;</p>
68、<p> signal wei:std_logic_vector(2 downto 0);</p><p> signal co0:std_logic_vector(3 downto 0);</p><p> signal co1:std_logic_vector(3 downto 0);</p><p> signal co2:std_logi
69、c_vector(3 downto 0);</p><p> signal co3:std_logic_vector(3 downto 0);</p><p> signal co4:std_logic_vector(3 downto 0);</p><p> signal co5:std_logic_vector(3 downto 0);</p>
70、<p> signal co6:std_logic_vector(3 downto 0);</p><p> signal co7:std_logic_vector(3 downto 0);</p><p><b> begin</b></p><p> process(clk)</p><p>
71、 variable cout:integer:=0;</p><p><b> begin </b></p><p> IF clk'event and clk='1' then</p><p> cout:=cout+1;</p><p> if cout<=25000 then
72、clk1<='0';</p><p> elsif cout<50000 then clk1<='1';</p><p> else cout:=0;</p><p><b> end if; </b></p><p><b> end if; <
73、;/b></p><p> end process; </p><p> process(clk)</p><p> variable cout:integer:=0;</p><p><b> BEGIN</b></p><p> IF clk'event and clk
74、='1' then</p><p> cout:=cout+1;</p><p> IF cout<=1250000 then clk2<='0';</p><p> elsif cout<25000000 then clk2<='1';</p><p> els
75、e cout:=0;</p><p><b> end if; </b></p><p><b> end if; </b></p><p> end process;</p><p> process(rst,start,clk2)</p><p> varia
76、ble reg8:std_logic_vector(7 downto 0);</p><p> variable fg:integer:=1;</p><p><b> begin</b></p><p> if rst='1' then</p><p> reg8:=(others=>
77、39;1');</p><p><b> fg:=1;</b></p><p> elsif clk2'event and clk2='1' then</p><p> if start='1' then</p><p> if fg=1 then reg8:=&
78、quot;11111110";</p><p><b> fg:=fg-1;</b></p><p> else reg8:=reg8(6 downto 0)®8(7);</p><p><b> end if;</b></p><p><b> end i
79、f;</b></p><p><b> end if;</b></p><p> din8<=reg8;</p><p> end process;</p><p> process(clk1)</p><p><b> begin</b><
80、/p><p> if clk1'event and clk1='1' then</p><p> if wei=7 then wei<="000";</p><p> else wei<=wei+1;</p><p><b> end if;</b></p
81、><p><b> end if;</b></p><p> end process;</p><p> process(wei)</p><p><b> begin</b></p><p> case wei is</p><p> whe
82、n "000" => selout<="00000001";</p><p> when "001" => selout<="00000010";</p><p> when "010" => selout<="00000100";
83、</p><p> when "011" => selout<="00001000";</p><p> when "100" => selout<="00010000";</p><p> when "101" => selout
84、<="00100000";</p><p> when "110" => selout<="01000000";</p><p> when "111" => selout<="10000000";</p><p> when ot
85、hers=>null;</p><p><b> end case;</b></p><p> end process;</p><p> process(rst,start,clk2)</p><p> variable ao0:std_logic_vector(3 downto 0);</p>
86、;<p> variable ao1:std_logic_vector(3 downto 0);</p><p> variable ao2:std_logic_vector(3 downto 0);</p><p> variable ao3:std_logic_vector(3 downto 0);</p><p> variable ao
87、4:std_logic_vector(3 downto 0);</p><p> variable ao5:std_logic_vector(3 downto 0);</p><p> variable ao6:std_logic_vector(3 downto 0);</p><p> variable ao7:std_logic_vector(3 down
88、to 0);</p><p><b> begin</b></p><p> if rst='1' then </p><p> ao0:=(others=>'0');</p><p> ao1:=(others=>'0');</p>&l
89、t;p> ao2:=(others=>'0');</p><p> ao3:=(others=>'0');</p><p> ao4:=(others=>'0');</p><p> ao5:=(others=>'0');</p><p>
90、 ao6:=(others=>'0'); </p><p> ao7:=(others=>'0');</p><p> elsif clk2'event and clk2='1' then</p><p> if start='1' then</p><p&
91、gt; if ao0<=9 then</p><p> ao0:=ao0+1;</p><p><b> end if;</b></p><p> if ao0>9 then</p><p> if ao1=9 and ao2=9 and ao3=9 and ao4=9 and ao5=9 and
92、 ao6=9 and ao7=9 then</p><p> ao0:=(others=>'0');</p><p> ao1:=(others=>'0');</p><p> ao2:=(others=>'0');</p><p> ao3:=(others=>
93、'0');</p><p> ao4:=(others=>'0');</p><p> ao5:=(others=>'0');</p><p> ao6:=(others=>'0');</p><p> ao7:=(others=>'0
94、39;); </p><p> else null;</p><p><b> end if; </b></p><p> if ao0>9 then </p><p> if ao1=9 and ao2=9 and ao3=9 and ao4=9 and ao5=9 and ao6=9 then
95、</p><p> ao7:=ao7+1;</p><p> ao0:=(others=>'0');</p><p> ao1:=(others=>'0');</p><p> ao2:=(others=>'0');</p><p> ao3:
96、=(others=>'0');</p><p> ao4:=(others=>'0');</p><p> ao5:=(others=>'0');</p><p> ao6:=(others=>'0');</p><p> else null;&l
97、t;/p><p><b> end if;</b></p><p><b> end if;</b></p><p> if ao0>9 then</p><p> if ao1=9 and ao2=9 and ao3=9 and ao4=9 and ao5=9 then </p&
98、gt;<p> ao6:=ao6+1;</p><p> ao0:=(others=>'0');</p><p> ao1:=(others=>'0');</p><p> ao2:=(others=>'0');</p><p> ao3:=(other
99、s=>'0');</p><p> ao4:=(others=>'0');</p><p> ao5:=(others=>'0');</p><p> else null;</p><p><b> end if;</b></p>&
100、lt;p><b> end if;</b></p><p> if ao0>9 then</p><p> if ao1=9 and ao2=9 and ao3=9 and ao4=9 then</p><p> ao5:=ao5+1;</p><p> ao0:=(others=>'
101、;0');</p><p> ao1:=(others=>'0');</p><p> ao2:=(others=>'0');</p><p> ao3:=(others=>'0');</p><p> ao4:=(others=>'0')
102、;</p><p> else null;</p><p><b> end if;</b></p><p><b> end if;</b></p><p> if ao0>9 then</p><p> if ao1=9 and ao2=9 and ao
103、3=9 then</p><p> ao4:=ao4+1; </p><p> ao0:=(others=>'0');</p><p> ao1:=(others=>'0');</p><p> ao2:=(others=>'0');</p><
104、p> ao3:=(others=>'0');</p><p> else null;</p><p><b> end if;</b></p><p><b> end if;</b></p><p> if ao0>9 then</p>&
105、lt;p> if ao1=9 and ao2=9 then</p><p> ao3:=ao3+1;</p><p> ao0:=(others=>'0');</p><p> ao1:=(others=>'0');</p><p> ao2:=(others=>'0
106、');</p><p> else null;</p><p><b> end if;</b></p><p><b> end if;</b></p><p> if ao0>9 then</p><p> if ao1=9 then</p&
107、gt;<p> ao2:=ao2+1;</p><p> ao0:=(others=>'0');</p><p> ao1:=(others=>'0');</p><p> else ao1:=ao1+1;</p><p> ao0:=(others=>'0
108、39;);</p><p> end if; </p><p> end if; </p><p><b> end if;</b></p><p><b> end if;</b></p><p><b> end if;</b>
109、</p><p><b> co0<=ao0;</b></p><p><b> co1<=ao1;</b></p><p><b> co2<=ao2;</b></p><p><b> co3<=ao3;</b><
110、/p><p><b> co4<=ao4;</b></p><p><b> co5<=ao5;</b></p><p><b> co6<=ao6;</b></p><p><b> co7<=ao7;</b></p&g
111、t;<p> end process;</p><p> process(wei,co0,co1,co2,co3,co4,co5,co6,co7)</p><p><b> begin</b></p><p> if wei="000" then</p><p> case c
112、o0 is</p><p> when "0000" => led7s1<="1000000";</p><p> when "0001" => led7s1<="1111001";</p><p> when "0010" =>
113、led7s1<="0100100";</p><p> when "0011" => led7s1<="0110000";</p><p> when "0100" => led7s1<="0011001";</p><p> wh
114、en "0101" => led7s1<="0010010";</p><p> when "0110" => led7s1<="0000010";</p><p> when "0111" => led7s1<="1111000"
115、;</p><p> when "1000" => led7s1<="0000000";</p><p> when "1001" => led7s1<="0010000";</p><p> when others=> null;</p>
116、<p><b> end case;</b></p><p><b> end if;</b></p><p> if wei="001" then</p><p> case co1 is</p><p> when "0000" =
117、> led7s1<="1000000";</p><p> when "0001" => led7s1<="1111001";</p><p> when "0010" => led7s1<="0100100";</p><p>
118、; when "0011" => led7s1<="0110000";</p><p> when "0100" => led7s1<="0011001";</p><p> when "0101" => led7s1<="0010010&
119、quot;;</p><p> when "0110" => led7s1<="0000010";</p><p> when "0111" => led7s1<="1111000";</p><p> when "1000" =>
120、 led7s1<="0000000";</p><p> when "1001" => led7s1<="0010000";</p><p> when others=> null;</p><p><b> end case;</b></p>
121、<p><b> end if;</b></p><p> if wei="010" then</p><p> case co2 is</p><p> when "0000" => led7s1<="1000000";</p><
122、;p> when "0001" => led7s1<="1111001";</p><p> when "0010" => led7s1<="0100100";</p><p> when "0011" => led7s1<="011
123、0000";</p><p> when "0100" => led7s1<="0011001";</p><p> when "0101" => led7s1<="0010010";</p><p> when "0110"
124、=> led7s1<="0000010";</p><p> when "0111" => led7s1<="1111000";</p><p> when "1000" => led7s1<="0000000";</p><p&g
125、t; when "1001" => led7s1<="0010000";</p><p> when others=> null;</p><p><b> end case;</b></p><p><b> end if;</b></p>
126、<p> if wei="011" then</p><p> case co3 is</p><p> when "0000" => led7s1<="1000000";</p><p> when "0001" => led7s1<=&quo
127、t;1111001";</p><p> when "0010" => led7s1<="0100100";</p><p> when "0011" => led7s1<="0110000";</p><p> when "0100&q
128、uot; => led7s1<="0011001";</p><p> when "0101" => led7s1<="0010010";</p><p> when "0110" => led7s1<="0000010";</p>&l
129、t;p> when "0111" => led7s1<="1111000";</p><p> when "1000" => led7s1<="0000000";</p><p> when "1001" => led7s1<="00
130、10000";</p><p> when others=> null;</p><p><b> end case;</b></p><p><b> end if;</b></p><p> if wei="100" then</p>&
131、lt;p> case co4 is</p><p> when "0000" => led7s1<="1000000";</p><p> when "0001" => led7s1<="1111001";</p><p> when "0
132、010" => led7s1<="0100100";</p><p> when "0011" => led7s1<="0110000";</p><p> when "0100" => led7s1<="0011001";</p>
133、;<p> when "0101" => led7s1<="0010010";</p><p> when "0110" => led7s1<="0000010";</p><p> when "0111" => led7s1<=&qu
134、ot;1111000";</p><p> when "1000" => led7s1<="0000000";</p><p> when "1001" => led7s1<="0010000";</p><p> when others=>
135、 null;</p><p><b> end case;</b></p><p><b> end if;</b></p><p> if wei="101" then</p><p> case co5 is</p><p> when &q
136、uot;0000" => led7s1<="1000000";</p><p> when "0001" => led7s1<="1111001";</p><p> when "0010" => led7s1<="0100100";<
137、/p><p> when "0011" => led7s1<="0110000";</p><p> when "0100" => led7s1<="0011001";</p><p> when "0101" => led7s1<
138、;="0010010";</p><p> when "0110" => led7s1<="0000010";</p><p> when "0111" => led7s1<="1111000";</p><p> when "
139、1000" => led7s1<="0000000";</p><p> when "1001" => led7s1<="0010000";</p><p> when others=> null;</p><p><b> end case;<
140、/b></p><p><b> end if;</b></p><p> if wei="110" then</p><p> case co6 is</p><p> when "0000" => led7s1<="1000000"
141、;</p><p> when "0001" => led7s1<="1111001";</p><p> when "0010" => led7s1<="0100100";</p><p> when "0011" => led7
142、s1<="0110000";</p><p> when "0100" => led7s1<="0011001";</p><p> when "0101" => led7s1<="0010010";</p><p> when &
143、quot;0110" => led7s1<="0000010";</p><p> when "0111" => led7s1<="1111000";</p><p> when "1000" => led7s1<="0000000";<
144、;/p><p> when "1001" => led7s1<="0010000";</p><p> when others=> null;</p><p><b> end case;</b></p><p><b> end if;</b
145、></p><p> if wei="111" then</p><p> case co7 is</p><p> when "0000" => led7s1<="1000000";</p><p> when "0001" =>
146、 led7s1<="1111001";</p><p> when "0010" => led7s1<="0100100";</p><p> when "0011" => led7s1<="0110000";</p><p> w
147、hen "0100" => led7s1<="0011001";</p><p> when "0101" => led7s1<="0010010";</p><p> when "0110" => led7s1<="0000010"
148、;;</p><p> when "0111" => led7s1<="1111000";</p><p> when "1000" => led7s1<="0000000";</p><p> when "1001" => led
149、7s1<="0010000";</p><p> when others=> null;</p><p><b> end case;</b></p><p><b> end if; </b></p><p> end process;</p>
150、<p><b> end;</b></p><p><b> 六、課程設(shè)計(jì)總結(jié)</b></p><p> 通過本次EDA課程設(shè)計(jì),讓我更進(jìn)一步的熟悉了VHDL語言,了解了其中的語法,同時,在做8個led燈循環(huán)顯示和數(shù)碼管的計(jì)數(shù)顯示的過程中,遇到了很多的困難,但從這些困哪中,我也受益匪淺,有困難才會提高,這樣自己才能學(xué)到更多的東西
溫馨提示
- 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. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內(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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 可控計(jì)數(shù)器的設(shè)計(jì)eda課程設(shè)計(jì)
- 光電計(jì)數(shù)器課程設(shè)計(jì)報告
- 電子計(jì)數(shù)器課程設(shè)計(jì)報告
- eda課程設(shè)計(jì)---十進(jìn)制加法計(jì)數(shù)器
- eda課程設(shè)計(jì)--十進(jìn)制加法計(jì)數(shù)器
- eda基于vhdl的24進(jìn)制計(jì)數(shù)器課程設(shè)計(jì)
- 2位10進(jìn)制加法計(jì)數(shù)器課程設(shè)計(jì)
- 光控計(jì)數(shù)器課程設(shè)計(jì)
- 6進(jìn)制計(jì)數(shù)器課程設(shè)計(jì)
- 課程設(shè)計(jì)--10進(jìn)制計(jì)數(shù)器以及8位按鍵顯示器
- 里程計(jì)數(shù)器課程設(shè)計(jì)
- 微機(jī)課程設(shè)計(jì)之計(jì)數(shù)器
- 課程設(shè)計(jì)報告--循環(huán)碼計(jì)數(shù)器
- 數(shù)電課程設(shè)計(jì)報告---光電計(jì)數(shù)器設(shè)計(jì)
- 里程計(jì)數(shù)器課程設(shè)計(jì)
- 24進(jìn)制計(jì)數(shù)器課程設(shè)計(jì)
- 頻率計(jì)數(shù)器課程設(shè)計(jì)
- 自動計(jì)數(shù)器課程設(shè)計(jì)課設(shè)報告
- 單片機(jī)計(jì)數(shù)器課程設(shè)計(jì)報告
- fpga課程設(shè)計(jì)---基于ram的十口8位計(jì)數(shù)器
評論
0/150
提交評論