VHDL語言數(shù)字秒表設計參考模板_第1頁
VHDL語言數(shù)字秒表設計參考模板_第2頁
VHDL語言數(shù)字秒表設計參考模板_第3頁
VHDL語言數(shù)字秒表設計參考模板_第4頁
VHDL語言數(shù)字秒表設計參考模板_第5頁
已閱讀5頁,還剩12頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、北 華 航 天 工 業(yè) 學 院EDA技術(shù)綜合設計課程設計報告報告題目: 數(shù)字秒表設計 作者所在系部: 電子工程系 作者所在專業(yè): 自動化專業(yè) 作者所在班級: 作 者 姓 名 : 指導教師姓名: 完 成 時 間 : 2011年12月2日 6 / 17內(nèi) 容 摘 要應用VHDL語言設計數(shù)字系統(tǒng),很多設計工作可以在計算機上完成,從而縮短了數(shù)字系統(tǒng)的開發(fā)時間。我們嘗試利用VHDL為開發(fā)工具設計數(shù)字秒表。秒表的邏輯結(jié)構(gòu)較簡單,它主要由十進制計數(shù)器、六進制計數(shù)器、數(shù)據(jù)選擇器、和顯示譯碼器等組成。在整個秒表中最關鍵的是如何獲得一個精確的100HZ計時脈沖,除此之外,整個秒表還需有一個啟動信號和一個清零信號,

2、以便秒表能隨意停止及啟動。 秒表有共有6個輸出顯示,分別為百分之一秒、十分之一秒、秒、十秒、分、十分,所以共有6個計數(shù)器與之相對應,6個計數(shù)器的輸出全都為BCD碼輸出,這樣便與同顯示譯碼器連接。關鍵詞: VHDL,數(shù)字鐘,MAX+plusII,時序仿真圖。 目 錄1、 實驗目的1二、硬件要求1三、方案論證1四、模塊說明11. 六進制計數(shù)器12. 十進制計數(shù)器23. 蜂鳴器34. 譯碼器45. 控制器56. 頂層文件8五、整體連接圖9六、實驗步驟10七、實驗結(jié)果10八、實驗總結(jié)10九、參考文獻10 課程設計任務書課題名稱數(shù)字秒表完成時間12.02指導教師職稱學生姓名班 級總體設計要求和技術(shù)要點設

3、計要求:秒表共有6個輸出顯示,分別為百分之一秒、十分之一秒、秒、十秒、分、十分,所以共有6個計數(shù)器與之相對應,6個計數(shù)器的輸出全都為BCD碼輸出,這樣便于和顯示譯碼器的連接。當計時達60分鐘后,蜂鳴器鳴響10聲。除此之外,整個秒表還需有一個啟動信號和一個歸零信號,以便秒表能隨意停止及啟動。設計要點:秒表的邏輯結(jié)構(gòu)較簡單,它主要由顯示譯碼器、分頻器、十進制計數(shù)器、六進制計數(shù)器和報警器組成。在整個秒表中最關鍵的是如何獲得一個精確的100HZ計時脈沖。工作內(nèi)容及時間進度安排工作內(nèi)容:在軟件上編輯、編譯程序,并仿真到達實驗要求。進度安排;課下編寫程序,并要求程序能通過編譯仿真;第十四周的周三在實驗板上

4、下載調(diào)試程序;周四課設答辯課程設計成果1與設計內(nèi)容對應的軟件程序2課程設計報告書3成果使用說明書一、 實驗目的 學習使用VHDL語言,以及EDA芯片的下載仿真二、硬件要求(1)主芯片EPF10K10LC84-4。(2)蜂鳴器。(3)8位八段掃描共陰極數(shù)碼顯示管。(4)二個按鍵開關(清零,開始)。三、方案論證數(shù)字秒表計時控制電路控制狀態(tài)機計時電路顯示電路分頻電路計數(shù)器六進制計數(shù)器掃描電路七段譯碼器十進制計數(shù)器 系統(tǒng)組成框圖四、模塊說明時鐘的設計共化分為6個模塊:六進制計數(shù)器(count6),十進制計數(shù)器(count10),報警電路(bs),掃描電路(seltime),譯碼電路(ym)。下面具體分

5、析各個模塊的原理、內(nèi)容和功能。(1)六進制計數(shù)器(count6)能夠?qū)崿F(xiàn)6進制循環(huán)計數(shù),帶有清零端stop、開始端start、時鐘信號端clk、其文本語言(文件名:count6.vhd)為底層文本,圖1為六進制計數(shù)器的仿真波形圖。library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity count6 is port (clk,clr,start:in std_logic; daout:out std_logic_vector(3 downto 0); cout:buffer std_logic

6、 );end count6;architecture behave of count6 is signal temp:std_logic_vector(3 downto 0);beginprocess(clk,clr) begin if clr='1' then temp<="0000" cout<='0' elsif clk'event and clk='1' then if start='1'then if temp="0101" then temp<=&quo

7、t;0000" cout<='1' else temp<=temp+1;cout<='0' end if; elsif start='0' then temp<=temp;cout<=cout; end if; end if; end process;daout<=temp; end behave;圖1. 六進制計數(shù)器的仿真波形(2)十進制計數(shù)器(COUNT10)能夠?qū)崿F(xiàn)10進制循環(huán)計數(shù),帶有清零端stop、開始端start、時鐘信號端clk、其文本語言(文件名:COUNT10.vhd)為底層文本,圖

8、2為十進制計數(shù)器的仿真波形圖library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity count10 is port (clk,clr,start:in std_logic; daout:out std_logic_vector(3 downto 0); cout:buffer std_logic );end count10;architecture behave of count10 is signal temp:std_logic_vector(3 downto 0);beginproce

9、ss(clk,clr) begin if clr='1' then temp<="0000" cout<='0' elsif clk'event and clk='1' then if start='1'then if temp="1001" then temp<="0000" cout<='1' else temp<=temp+1; cout<='0' end if; elsif start=&

10、#39;0' then temp<=temp;cout<=cout; end if; end if; end process;daout<=temp; end behave;圖2. 十進制分計數(shù)器的仿真波形(3)蜂鳴器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity alarm isport(clk,I:in std_logic; q:out std_logic );end alarm;architecture ar of alarm issignal n:i

11、nteger range 0 to 20;signal q0:std_logic;beginprocess(clk)begin if clk'event and clk='1' thenif i='0' then q0<='0'n<=0;else if n<=19 then q0<=not(q0);n<=n+1;else q0<='0'n<=0;end if;end if;end if;end process;q<=q0;end ar;(4)譯碼器library ieee;

12、use ieee.std_logic_1164.all; entity ym is port(num:in std_logic_vector(3 downto 0); led:out std_logic_vector(6 downto 0); end ym ; architecture a of ym is begin process(num) begin case num is when"0000"=>led<="0111111" when"0001"=>led<="0000110" wh

13、en"0010"=>led<="1011011" when"0011"=>led<="1001111" when"0100"=>led<="1100110" when"0101"=>led<="1101101" when"0110"=>led<="1111101" when"0111"=>led<=&quo

14、t;0100111" when"1000"=>led<="1111111" when"1001"=>led<="1101111" when others=>led<="0000000" end case; end process; end a;(5)控制器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity seltime is port(clr

15、,clk: in bit; dain0,dain1,dain2,dain3,dain4,dain5: in std_logic_vector(3 downto 0); sel: out std_logic_vector(2 downto 0); daout: out std_logic_vector(3 downto 0);end seltime;architecture b of seltime is signal temp:integer range 0 to 5;begin process(clk) begin if clr='1' then daout<=&quo

16、t;0000";sel<="000";temp<=0; else if clk'event and clk='1' then if temp=5 then temp<=0; else temp<=temp + 1; end if; end if; case temp is when 0=>sel<="000"daout<=dain0; when 1=>sel<="001"daout<=dain1; when 2=>sel<=&qu

17、ot;010"daout<=dain2; when 3=>sel<="011"daout<=dain3; when 4=>sel<="100"daout<=dain4; when 5=>sel<="101"daout<=dain5; end case; end if; end process;end b;(6)整個的例話語句library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;us

18、e ieee.std_logic_unsigned.all;entity chengpin isport( stop,clk,clk2,start:in std_logic; sel :out std_logic_vector(2 downto 0); a,b,c,d,e,f,g :out std_logic; speak :out std_logic);end chengpin;architecture c of chengpin iscomponent count10 port( clk,clr,start: in std_logic; daout :out std_logic_vecto

19、r(3 downto 0); cout :out std_logic);end component;component count6 port( clk,clr,start:in std_logic; daout :out std_logic_vector(3 downto 0); cout :out std_logic);end component;component seltime port( clr,clk :in std_logic; dain1 :in std_logic_vector(3 downto 0); dain2 :in std_logic_vector(3 downto

20、0); dain3 :in std_logic_vector(3 downto 0); dain4 :in std_logic_vector(3 downto 0); dain5 :in std_logic_vector(3 downto 0); dain6 :in std_logic_vector(3 downto 0); sel :out std_logic_vector(2 downto 0); daout :out std_logic_vector(3 downto 0);end component;component alarm port( clk,i :in std_logic;

21、q :out std_logic);end component;component ym port( num :in std_logic_vector(3 downto 0); led :out std_logic_vector(6 downto 0);end component;component cfq port( clk,d :in std_logic; y :out std_logic);end cfq;beginsignal count_cout :std_logic_vector(6 downto 0);signal daout1,daout2,daout3,daout4,daou

22、t5,daout6,daout7:std_logic_vector(3 downto 0);signal ledout :std_logic_vector(6 downto 0);begina=>ledout(0);b=>ledout(1);c=>ledout(2);d=>ledout(3);e=>ledout(4);f=>ledout(5);g=>ledout(6);u1: count10 port map(clk,stop,start,daout1,count_cout(0);u2: count10 port map(count_cout(0),s

23、top,start,daout2,count_cout(1);u3: count10 port map(count_cout(1),stop,start,daout3,count_cout(2);u4: count6 port map(count_cout(2),stop,start,daout4,count_cout(3);u5: count10 port map(count_cout(3),stop,start,daout5,count_cout(4);u6: count6 port map(count_cout(4),stop,start,daout6,count_cout(5);u7:

24、cfq port map(clk2,count_cout(5),count_cout(6);u7:seltime port map(stop,clk,daout1,daout2,daout3,daout4,daout5,daout6,sel,daout7);u8: ym port map(daout7,ledout);u9: alarm port map(clk,count_cout(6),speak);end c;五、數(shù)字鐘的整體連接圖9 圖6. 數(shù)字鐘各個模塊連接示意圖六、實驗步驟(1)安裝MAX+plus軟件,為本項設計建立文件夾。(2)輸入設計項目的各個模塊,存盤檢查,編譯并仿真至無誤。(3)調(diào)用底層文件的各個模塊,連接整體原理圖,進行存盤檢查,編譯仿真至無誤。(4)將PC機與試驗箱進行連接選擇器件并鎖定引腳,然后進行編譯下載。(5)按照鎖定好的引腳進行連線,進行硬件測試,驗證仿真和測試結(jié)果。七、實驗結(jié)果 通過硬件測試,得到如下測試結(jié)果:(1)數(shù)碼管能夠正確顯示時鐘數(shù)字。(2)給復位端(reset)低電平時,能夠進行復位。(3)給手動調(diào)時(sethour)調(diào)分(setmin)信號端

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論