數(shù)字邏輯設計_第1頁
數(shù)字邏輯設計_第2頁
數(shù)字邏輯設計_第3頁
數(shù)字邏輯設計_第4頁
數(shù)字邏輯設計_第5頁
已閱讀5頁,還剩14頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、2014-2015(1)學期數(shù)字邏輯課程設計多功能數(shù)字電子表學院:計算機與控制工程班級: 計131姓名: 段倫彪學號: 201358501108指導老師:沙麗杰一、 功能簡介1.正常計時:秒(16)、分(16)、小時(12)計數(shù);秒計時的頻率為1Hz,數(shù)碼管用動態(tài)掃描實時顯示計時的秒、分、小時。2.整點報時:逢整點蜂鳴器在“15”分鐘的第11、13、秒發(fā)頻率為512Hz的低音,在“15”分鐘的第15秒發(fā)頻率為1024Hz的高音。3.校時:校小時(K11),顯示小時數(shù)碼管以4Hz的頻率遞增計數(shù);4.暫停功能,在某個時間打開暫停開關,時間會在同時停止,當關閉開關之后,時間繼續(xù)往下計時。5.復位功能

2、,當打開復位開關時,時分秒全部清零, 二、 總體結構框圖三、 各模塊框圖1、 計時器2、 動態(tài)顯示3、 分頻器 4、 報時器四、 各模塊VHDL程序分頻器1,功能是把1024hz的頻率信號轉換成512hz的頻率:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fenpin1 is port(clk:in std_logic; clr:in std_logic; y:out std_logic_vector(1 downto 0); co:out std_logic);end fenp

3、in1;architecture fp1 of fenpin1 issignal q: std_logic_vector(1 downto 0);begin process(clk) begin if(clr=0) then q=00; co=0; elsif(clkevent and clk=1) then if(q=01) then q=00; co=1; else q=q+1; co=0; end if; end if; y=q; end process;end fp1;二選一,功能主要實現(xiàn)調時的功能,當kg打開時,小時的計數(shù)器以4hz的頻率遞增,由此實現(xiàn)小時的快速調時:library

4、ieee;use ieee.std_logic_1164.all;entity mux2 isport(min,hz,kg:in std_logic; h:out std_logic);end mux2;architecture m2 of mux2 isbegin process(kg) begin if(kg=1) then h=hz; else h=min; end if; end process;end m2;分頻器2,把4hz的頻率信號轉化成1hz的信號,4hz的用于小時的調時,1hz的用于秒正常輸入信號:library ieee;use ieee.std_logic_1164.al

5、l;use ieee.std_logic_unsigned.all;entity fenpin is port(clk:in std_logic; clr:in std_logic; y:out std_logic_vector(1 downto 0); co:out std_logic);end fenpin;architecture fp of fenpin issignal q: std_logic_vector(1 downto 0);begin process(clk) begin if(clr=0) then q=00; co=0; elsif(clkevent and clk=1

6、) then if(q=11) then q=00; co=1; else q=q+1; co=0; end if; end if; y=q; end process;end fp;12進制計數(shù)器:小時每12循環(huán)一次:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity count_12 is port(clk:in std_logic; clr:in std_logic; msh:out std_logic_vector(7 downto 4); msl:out std_logic_ve

7、ctor(3 downto 0); co:out std_logic); end count_12;architecture c12 of count_12 issignal qh:std_logic_vector(7 downto 4);signal ql:std_logic_vector(3 downto 0);begin process(clk) begin if(clr=0) then qh=0000; ql=0000; co=0; elsif(clkevent and clk=1) then if(qh=0001 and ql=0001) then qh=0000; ql=0000;

8、 co=1; elsif(ql=1001) then qh=qh+1; ql=0000; co=0; else qh=qh; ql=ql+1; co=0; end if; end if; msh=qh; msl=ql; end process; end c12;16進制計數(shù)器,用于秒和小時的計數(shù):library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity count_16 is port(clk:in std_logic; clr:in std_logic; msh:out std_logic_

9、vector(7 downto 4); msl:out std_logic_vector(3 downto 0); co:out std_logic); end count_16;architecture c16 of count_16 issignal qh:std_logic_vector(7 downto 4);signal ql:std_logic_vector(3 downto 0);begin process(clk) begin if(clr=0) then qh=0000; ql=0000; co=0; elsif(clkevent and clk=1) then if(qh=

10、0001 and ql=0101) then qh=0000; ql=0000; co=1; elsif(ql=1001) then qh=qh+1; ql=0000; co=0; else qh=qh; ql=ql+1; co=0; end if; end if; msh=qh; msl=ql; end process; end c16;響鈴,其實是二選一選擇器,用于輸出1024還是512hz的鈴聲:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity alarm1 isport (mi

11、n2,min1,sce2,sce1:in std_logic_vector(3 downto 0); clk1,clk2: in std_logic; q:out std_logic);end alarm1;architecture a1 of alarm1 isbegin process(sce1,sce2,clk1,clk2) begin if(min2=0001 and min1=0101) then if ( sce2=0001and sce1=0001) then q=clk1; elsif(sce2=0001 and sce1=0011) then q=clk1; elsif(sc

12、e2=0001 and sce1=0101) then q=clk2; else q=0; end if; else q=0; end if;end process;end a1;模8計數(shù)器:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity count_8 is port(clk:in std_logic; clr:in std_logic; y:out std_logic_vector(2 downto 0); co:out std_logic); end count_8;archi

13、tecture c8 of count_8 issignal q:std_logic_vector(2 downto 0);begin process(clk) begin if clr=0 then q=000;co=0; elsif(clkevent and clk=1) then if(q=111) then q=000;co=1; else q=q+1;co=0; end if; end if; y=q; end process;end c8;8選一選擇器:library ieee;use ieee.std_logic_1164.all;entity mux8_1 isport(h1,

14、h0,m1,m0:in std_logic_vector(3 downto 0); s1,s0,k1,k2:in std_logic_vector(3 downto 0); sel:in std_logic_vector(2 downto 0); y:out std_logic_vector(3 downto 0);end mux8_1;architecture m8 of mux8_1 isbegin process(sel) begin if(sel=000) then y=h1; elsif(sel=001) then y=h0; elsif(sel=010) then y=k1; el

15、sif(sel=011) then y=m1; elsif(sel=100) then y=m0; elsif(sel=101) then y=k2; elsif(sel=110) then y=s1; elsif(sel=111) then ycoutcoutcoutcoutcoutcoutcoutcoutcoutcoutcout=0000001; end case; end if; end process;end rtl;五、 仿真圖二選一選擇器波形仿真圖:4選一波形仿真圖:12進制波形仿真圖:六、 下載檢驗1. 正常計時:秒(16)、分(16)、小時(12)計數(shù);秒計時的頻率為1Hz,數(shù)碼管用動態(tài)掃描實時顯示計時的秒、分、小時。2. 整點報時:逢整點蜂鳴器在“15”分鐘的第11、13、秒發(fā)頻率為512Hz的低音,在“15”分鐘的第15秒發(fā)頻率為1024Hz的高音。3. 校時:提供高電平時,顯示小時數(shù)碼管以4Hz的頻率遞增計數(shù);七、 心得體會通過此次自己動手編程這個數(shù)字電子表,對quartus

溫馨提示

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

評論

0/150

提交評論