VHDL數(shù)字秒表設(shè)計_第1頁
VHDL數(shù)字秒表設(shè)計_第2頁
VHDL數(shù)字秒表設(shè)計_第3頁
VHDL數(shù)字秒表設(shè)計_第4頁
VHDL數(shù)字秒表設(shè)計_第5頁
已閱讀5頁,還剩6頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、VHDL數(shù)字秒表設(shè)計 專 業(yè): 自動化 班級學(xué)號: 5090629 姓 名: 劉丹 2011年 6 月14 日VHDL語言課程設(shè)計-秒表設(shè)計一、設(shè)計實驗?zāi)康模涸贛AX+plusII軟件平臺上,熟練運用VHDL語言,完成數(shù)字時鐘設(shè)計的軟件編程、編譯、綜合、仿真,使用EDA實驗箱,實現(xiàn)數(shù)字秒表的硬件功能。二、設(shè)計實驗說明及要求:1、數(shù)字秒表主要由:分頻器、掃描顯示譯碼器、一百進制計數(shù)器、六十進制計數(shù)器(或十進制計數(shù)器與6進制計數(shù)器)、十二進制計數(shù)器(或二十四進制計數(shù)器)電路組成。在整個秒表中最關(guān)鍵的是如何獲得一個精確的100HZ計時脈沖,除此之外,數(shù)字秒表需有清零控制端,以及啟動控制端、保持保持,

2、以便數(shù)字時鐘能隨意停止及啟動。2、數(shù)字秒表顯示由時(12或24進制任選)、分(60進制)、秒(60進制)、百分之一秒(一百進制)組成,利用掃描顯示譯碼電路在八個數(shù)碼管顯示。3、能夠完成清零、啟動、保持(可以使用鍵盤或撥碼開關(guān)置數(shù))功能。4、時、分、秒、百分之一秒顯示準(zhǔn)確。三、我的設(shè)計思路:    1、四個十進制計數(shù)器:用來分別對百分之一秒、十分之秒、秒和分進行計數(shù);    2、兩個6進制計數(shù)器:用來分別對十秒和十分進行計數(shù);3、一個24進制計數(shù)器,用來對小時進行計數(shù);    3、分頻率器:用來產(chǎn)生100H

3、z的計數(shù)脈沖;    4、顯示譯碼器:完成對顯示譯碼的控制。四、設(shè)計過程:1.分頻器:由10MHz變?yōu)?00Hz,10MHz的周期是10的(-7)次方,而100Hz的周期是10的(-2)次方,而且方波是高低相間,只有高電平有效,所以100Hz的周期需要取一半,即0.02秒,這樣算出的分頻倍數(shù)就是50000分頻器代碼:將10MHz脈沖變成100Hz程序:library ieee;use ieee.std_logic_1164.all;entity fenpin is port(clr,clk: in bit;q: buffer bit);end fenpi

4、n;architecture a of fenpin is   signal counter:integer range 0 to 49999;begin    process(clr,clk)      begin  if (clk='1' and clk'event) then         if clr='1' then  

5、60;         counter<=0;  elsif counter=49999 then            counter<=0;            q<= not q;    else 

6、60;          counter<=counter+1;         end if;       end if;     end process;end a;分頻器的仿真圖:2.十進制計數(shù)器:原理為加法計數(shù)器,從0加到9,計到10個數(shù)時由cout進位程序:library ieee; use ieee.std_l

7、ogic_1164.all;use ieee.std_logic_unsigned.all;entity c10 is    port(clr,start,clk: in bit;      cout: out bit;      daout: out std_logic_vector(3 downto 0);end c10;,architecture a of c10 is    signal temp:std_l

8、ogic_vector(3 downto 0);begindaout<=temp;    process(clk,clr)    begin        if clr='1' then                temp<="0000" 

9、0;             cout<='0'         elsif (clk'event and clk='1') then               if start='1' then 

10、0;          if temp>="1001" then                 temp<="0000"              

11、;   cout<='1'                  else                     temp<=temp+1;    

12、60;                 cout<='0'                  end if;             &#

13、160;  end if;         end if;          end process;end a;十進制計數(shù)器仿真圖:3.六進制計數(shù)器:原理為加法計數(shù)器,從0 加到5計到第六個數(shù)時由cout進位。程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity c6 is    port(cl

14、r,start,clk: in bit;         daout: out std_logic_vector(3 downto 0);         cout: out std_logic);end c6;architecture a of c6 is    signal temp:std_logic_vector(3 downto 0);begindaout<=temp;  

15、;  process(clk,clr)    begin       if clr='1' then              temp<="0000"             cout<='0'

16、        elsif (clk'event and clk='1') then       if start='1' then        if temp>="0101" then             

17、      temp<="0000"                  cout<='1'                 else   &#

18、160;                temp<=temp+1;                     cout<='0'         

19、;        end if;               end if;        end if; end process; end a;6進制計數(shù)器仿真圖:4、二十四進制計數(shù)器采用一個二進制的計數(shù)器和一個四進制的計數(shù)器相結(jié)合到一起,低位從0到9,到9向高位進一,當(dāng)?shù)臀挥嫷剿?,高位計?,進行進位輸出,即每二十四個數(shù)進行一次進位輸

20、出library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity c24 isport(clr,start,clk:in std_logic;hour1,hour0:out std_logic_vector(3 downto 0);end c24;architecture a of c24 isbegin process(clr,clk)variable cnt1,cnt0:std_logic_vector(3 downto 0);beginif clr='1' then cnt0:

21、="0000" cnt1:="0000"elsif clk'event and clk='1' thenif start='1' thenif cnt1="0010" and cnt0="0011"then cnt1:="0000"cnt0:="0000"elsif cnt0<"1001" then cnt0:=cnt0+1;else cnt0:="0000"cnt1:=cnt1+1;end

22、 if;end if;end if;hour1<=cnt1;hour0<=cnt0;end process;end a;24進制計數(shù)器仿真圖:5.數(shù)據(jù)選擇和數(shù)碼管選擇模塊代碼:其功能是選擇計數(shù)端口來的數(shù)據(jù),當(dāng)相應(yīng)的數(shù)據(jù)到來時數(shù)據(jù)選擇器數(shù)據(jù)后輸數(shù)給數(shù)碼管,并由數(shù)碼管顯示。八個數(shù)碼管分別顯示小時,分鐘,秒,百分秒library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity seltime isport(clk: in bit;dain0,dain1,dain2,dain3,dain4,da

23、in5,dain6,dain7: 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 a of seltime issignal temp:integer range 0 to 7;beginprocess(clk)beginif (clk='1'and clk'event) thenif temp=7 then temp<=0;else temp&

24、lt;=temp + 1;end if;case temp iswhen 0=>sel<="000"daout<=dain0;when 1=>sel<="001"daout<=dain1;when 2=>sel<="010"daout<=dain2;when 3=>sel<="011"daout<=dain3;when 4=>sel<="100"daout<=dain4;when 5=>sel<

25、="101"daout<=dain5;when 6=>sel<="110"daout<=dain6;when 7=>sel<="111"daout<=dain7;end case;end if;end process;end a;仿真圖:5.數(shù)碼管驅(qū)動模塊代碼:數(shù)碼管驅(qū)動電路,驅(qū)動數(shù)碼管發(fā)光。library ieee;use ieee.std_logic_1164.all;entity deled isport(num:in std_logic_vector(3 downto 0);led:out std_logic_vector(6 downto 0);end deled ;architecture a of deled isbeginprocess(num)begincase num iswhen"0000"=>led<="0111111"-3FHwhen"0001"=>led<="0000110"-06Hwhen"0010&quo

溫馨提示

  • 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)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論