數(shù)字時鐘顯示實驗報告_第1頁
數(shù)字時鐘顯示實驗報告_第2頁
數(shù)字時鐘顯示實驗報告_第3頁
數(shù)字時鐘顯示實驗報告_第4頁
數(shù)字時鐘顯示實驗報告_第5頁
已閱讀5頁,還剩19頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、實驗名稱:數(shù)字時鐘設(shè)計實驗儀器及軟件:計算機(jī),quartas。實驗?zāi)康模?全面了解如何應(yīng)用該硬件描述語言進(jìn)行高速集成電路設(shè)計;2.通過對數(shù)字時鐘軟件設(shè)計環(huán)節(jié)與仿真環(huán)節(jié)熟悉quartus ii設(shè)計與仿真環(huán)境;3. 通過對數(shù)字時鐘的設(shè)計,掌握硬件系統(tǒng)設(shè)計方法(自底向上或自頂向下),熟悉vhdl語言三種設(shè)計風(fēng)格,熟悉其芯片硬件實現(xiàn)的過程。4 體會硬件設(shè)計語言在工程中的重要性。全面掌握設(shè)計方法和過程。實驗要求:設(shè)計一個數(shù)字時鐘,并輸出到數(shù)碼管顯示時,分,秒。實驗原理:a 整體系統(tǒng)實行自頂下的原則,通過頂層實體分別串接各個設(shè)計部件,各個部件接口通過端口映射的方式進(jìn)行串接,從而達(dá)到設(shè)計目的。b 整個程序中

2、涉及的部件有:(1)分頻器,對輸入時鐘40mhz進(jìn)行40000000分頻,得到1hz信號,作為計數(shù)器的計數(shù)時鐘;對輸入時鐘40mhz進(jìn)行400000分頻,得到100hz信號,作為數(shù)碼顯示管位掃描信號(2)計數(shù)器,用24進(jìn)制計數(shù)器作為小時位的計數(shù),用60進(jìn)制計數(shù)器作為分位,秒位的計數(shù)。(3)位選程序,實現(xiàn)六個數(shù)碼顯示管動態(tài)掃描顯示,(4)led顯示程序:用于顯示信號在數(shù)碼管。(5)頂層模塊實體部分,指明了輸入輸出端口,各部分的聯(lián)系和鏈接,以及通過端口映射連接各部分,實現(xiàn)整個程序功能。c 關(guān)于動態(tài)顯示,掃描頻率設(shè)置為100hz,這個頻率大于要求的50hz,利用人眼的視覺暫留效果,則看不到閃爍現(xiàn)象,

3、可以實現(xiàn)動態(tài)顯示功能。d 在計數(shù)器的時鐘選擇上,選擇的是1hz頻率,滿足了每秒一次的要求。設(shè)計思路及vhdl代碼e兩個模60的計數(shù)器來代表時鐘的秒針,分針,再用一個模23的計數(shù)器來代替時針。外部基礎(chǔ)時鐘信號作為秒針計數(shù)器的時鐘信號,秒針計數(shù)器的近進(jìn)位信號作為分針計數(shù)器的時鐘信號,分針計數(shù)器的進(jìn)位信號有作為時針計數(shù)器的時鐘信號,最后在統(tǒng)一輸出。需要注意的是到23時59分59秒后下次跳動清零,從頭開始?;A(chǔ)時鐘信號選擇1hz最為簡單。我們做了以40mhz為基礎(chǔ)時鐘信號的時鐘,主要要點在將40mhz分頻到1hz。下面通過原理結(jié)構(gòu)圖描述系統(tǒng)m=3計數(shù)器 數(shù)碼管譯碼器時鐘信號進(jìn)位信號m=10計數(shù)器 數(shù)碼

4、管譯碼器時鐘信號進(jìn)位信號m=6計數(shù)器 數(shù)碼管譯碼器進(jìn)位信號時鐘信號m=10計數(shù)器 數(shù)碼管譯碼器m=10計數(shù)器 數(shù)碼管譯碼器秒針個位顯示信號秒針計數(shù)器m=6計數(shù)器 數(shù)碼管譯碼器時鐘信號進(jìn)位信號秒針十位顯示信號時鐘信號進(jìn)位信號分針個位顯示信號分針十位顯示信號時針個位顯示信號時針十位顯示信號分針計數(shù)器時針計數(shù)器s110=s110+1s110=”0101”?時鐘信號時鐘上升沿?s220=”1001”?s220=s220+1s220=”0000”s110=”0000”輸出上升沿脈沖外部基礎(chǔ)時鐘信號yny nym110=m110+1m110=”0101”?時鐘信號時鐘上升沿?m220=”1001”?m22

5、0=m220+1m220=”0000”m110=”0000”輸出上升沿脈沖y ny ny秒針計數(shù)器提供 h110=h110+1h110=”0101”?時鐘信號時鐘上升沿?h220=”1001”?h220=h220+1h220=”0000”h110=”0000”輸出上升沿脈沖分針計數(shù)器提供y ny ny一,頂層實體模塊源代碼數(shù)字鐘的頂層模塊程序 clock.vhd library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity clock is

6、port(clk :in std_logic; set :in std_logic; qin_s_1 : in std_logic_vector(3 downto 0); -秒鐘的低位調(diào)整輸入端 qin_s_2 : in std_logic_vector(3 downto 0); -秒鐘的高位調(diào)整輸入端 qin_m_1 : in std_logic_vector(3 downto 0); -分鐘的低位調(diào)整輸入端 qin_m_2 : in std_logic_vector(3 downto 0); -分鐘的高位調(diào)整輸入端 qin_h_1 : in std_logic_vector(3 downt

7、o 0); -時鐘的低位調(diào)整輸入端 qin_h_2 : in std_logic_vector(3 downto 0); -時鐘的高位調(diào)整輸入端 qout : out std_logic_vector(6 downto 0); -7段碼輸出 sel : out std_logic_vector(5 downto 0) -位選輸出端 );end clock;architecture behave of clock iscomponent cnt24 is port(clk : in std_logic; set : in std_logic; din1 : in std_logic_vector

8、(3 downto 0); din2 : in std_logic_vector(3 downto 0); qout1 : out std_logic_vector(3 downto 0); qout2 : out std_logic_vector(3 downto 0);end component cnt24;component cnt60 is port(clk : in std_logic; set : in std_logic; din1 : in std_logic_vector(3 downto 0); din2 : in std_logic_vector(3 downto 0);

9、 qout1 : out std_logic_vector(3 downto 0); qout2 : out std_logic_vector(3 downto 0); carry : out std_logic);end component cnt60;component fen1 is port(clk:in std_logic; qout:out std_logic);end component fen1;component fen100 is port(clk:in std_logic; qout:out std_logic);end component fen100;componen

10、t weixuan is port(clk : in std_logic; qin1 : in std_logic_vector(3 downto 0); qin2 : in std_logic_vector(3 downto 0); qin3 : in std_logic_vector(3 downto 0); qin4 : in std_logic_vector(3 downto 0); qin5 : in std_logic_vector(3 downto 0); qin6 : in std_logic_vector(3 downto 0); qout : out std_logic_v

11、ector(3 downto 0); sel : out std_logic_vector(5 downto 0); end component weixuan;component led_driv is port(qin : in std_logic_vector(3 downto 0); qout : out std_logic_vector(6 downto 0);end component led_driv;signal carry1: std_logic;signal carry2: std_logic;signal qout1 : std_logic;signal qout100

12、: std_logic;signal qout_s_1:std_logic_vector(3 downto 0);signal qout_s_2:std_logic_vector(3 downto 0);signal qout_m_1:std_logic_vector(3 downto 0);signal qout_m_2:std_logic_vector(3 downto 0);signal qout_h_1:std_logic_vector(3 downto 0);signal qout_h_2:std_logic_vector(3 downto 0);signal qouti:std_l

13、ogic_vector(3 downto 0);beginu0:fen1 port map(clk=clk,qout=qout1);u1:fen100 port map(clk=clk,qout=qout100);u2:cnt60 port map(clk=qout1,set=set,din1=qin_s_1,din2=qin_s_2,qout1=qout_s_1,qout2=qout_s_2,carry=carry1);u3:cnt60 port map(clk=carry1,set=set,din1=qin_m_1,din2=qin_m_2,qout1=qout_m_1,qout2=qou

14、t_m_2,carry=carry2);u4:cnt24 port map(clk=carry2,set=set,din1=qin_h_1,din2=qin_h_2,qout1=qout_h_1,qout2=qout_h_2);u5:weixuan port map(clk=qout100,qin1=qout_s_1,qin2=qout_s_2,qin3=qout_m_1,qin4=qout_m_2,qin5=qout_h_1,qin6=qout_h_2,qout=qouti,sel=sel);u6:led_driv port map(qin=qouti,qout=qout);end beha

15、ve;這部分實現(xiàn)的是頂層實體,它是程序的核心,通過端口映射把其他各部件程序端口連接為一個整體,指明系統(tǒng)的輸入端口,輸出端口,輸入型號,輸出信號。二,分頻部分1,功 能:對輸入時鐘40mhz進(jìn)行40000000分頻,得到1hz信號接 口:clk -時鐘輸入 qout-秒輸出信號library ieee;use ieee.std_logic_1164.all;entity fen1 isport(clk:in std_logic; qout:out std_logic);end fen1;architecture behave of fen1 isconstant counter_len:inte

16、ger:=10#39999999#;signal cnt:integer range 0 to counter_len;begin process(clk) begin if clkevent and clk=1 then case cnt is when 0 to counter_len/2=qoutqout=1; end case; if cnt=counter_len then cnt=0; else cntqoutqout=1; end case; if cnt=counter_len then cnt=0; else cntqout=qin1; selqout=qin2; selqo

17、ut=qin3; selqout=qin4; selqout=qin5; selqout=qin6; selqout=0000; sel=111111; end case; if cnt=5 then cnt:=0; else cnt:=cnt+1; end if; end if; end process;end behave; 這部分程序?qū)崿F(xiàn)的是位選功能,用于動態(tài)顯示,調(diào)整秒位,分位,時位。四,計數(shù)器的設(shè)計功 能:24進(jìn)制計數(shù)器-接 口:clk -時鐘輸入- set -時間使能端- din1 -個位數(shù)據(jù)預(yù)置輸入- din2 -十位數(shù)據(jù)預(yù)置輸入- qout1-個位bcd輸出- qout2-十位

18、bcd輸出library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity cnt24 is port(clk : in std_logic; set : in std_logic; din1 : in std_logic_vector(3 downto 0); din2 : in std_logic_vector(3 downto 0); qout1 : out std_logic_vector(3 downto 0); qout2 : ou

19、t std_logic_vector(3 downto 0);end cnt24;architecture behave of cnt24 issignal tem1:std_logic_vector(3 downto 0);signal tem2:std_logic_vector(3 downto 0);begin process(clk,set,din1,din2) begin if set=1 then tem1=din1; tem2=din2; elsif clkevent and clk=1 then if (tem2=0010 and tem1=0011) then tem1=00

20、00; tem2=0000; elsif(tem2/=0010 and tem1=1001) then tem2=tem2+1; tem1=0000; else tem2=tem2; tem1=tem1+1; end if; end if; end process; qout1=tem1; qout2=tem2;end behave;這部分設(shè)計了一個24進(jìn)制計數(shù)器,用于小時位的計數(shù),解決了時鐘位顯示的問題。-功 能:24進(jìn)制計數(shù)器-接 口:clk -時鐘輸入- set -時間使能端- din1 -個位數(shù)據(jù)預(yù)置輸入- din2 -十位數(shù)據(jù)預(yù)置輸入- qout1-個位bcd輸出- qout2-十位

21、bcd輸出-library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity cnt24 is port(clk : in std_logic; set : in std_logic; din1 : in std_logic_vector(3 downto 0); din2 : in std_logic_vector(3 downto 0); qout1 : out std_logic_vector(3 downto 0); qout2 : o

22、ut std_logic_vector(3 downto 0);end cnt24;architecture behave of cnt24 issignal tem1:std_logic_vector(3 downto 0);signal tem2:std_logic_vector(3 downto 0);begin process(clk,set,din1,din2) begin if set=1 then tem1=din1; tem2=din2; elsif clkevent and clk=1 then if (tem2=0010 and tem1=0011) then tem1=0

23、000; tem2=0000; elsif(tem2/=0010 and tem1=1001) then tem2=tem2+1; tem1=0000; else tem2=tem2; tem1=tem1+1; end if; end if; end process; qout1=tem1; qout2qoutqoutqoutqoutqoutqoutqoutqoutqoutqoutnull; end case; end process;end behave; -這部分的設(shè)計用于數(shù)碼管上的顯示,動態(tài)掃描的頻率用100hz,這個頻率是分頻得到的。解決了數(shù)字顯示的問題。實驗結(jié)果和分析數(shù)字時鐘顯示仿真

24、圖整體輸入輸出數(shù)字時鐘顯示仿真如上圖所示,clk1為外部輸入時鐘信號為,qout依次為時鐘各位對應(yīng)數(shù)碼管的信號.圖二所示數(shù)碼管上顯示。二十四進(jìn)制計數(shù)器仿真圖六十進(jìn)制計數(shù)器仿真圖100hz分頻器仿真圖 位選部分仿真圖led顯示仿真圖故障排除及問題分析1, 開始時,分頻器沒有設(shè)計,直接將現(xiàn)有頻率加入,沒有顯示出結(jié)果,后反復(fù)思考,加入了分頻器部分,重新將端口調(diào)整,成功顯示出了結(jié)果。2, 在老師的指導(dǎo)下,有加入了報時功能,事先選擇的是將到12:00:00直接送一個信號給輸出端,事先報時,設(shè)計程序如下library ieee;use ieee.std_logic_1164.all;use ieee.st

25、d_logic_unsigned.all;use ieee.std_logic_arith.all;entity baoshi isport( qin_s_1 : in std_logic_vector(3 downto 0); -秒鐘的低位調(diào)整輸入端 qin_s_2 : in std_logic_vector(3 downto 0); -秒鐘的高位調(diào)整輸入端 qin_m_1 : in std_logic_vector(3 downto 0); -分鐘的低位調(diào)整輸入端 qin_m_2 : in std_logic_vector(3 downto 0); -分鐘的高位調(diào)整輸入端 qin_h_1 : in std_logic_vector(3 downto 0); -時鐘的低位調(diào)整輸入端 qin_h_2 : in std_logic_vector(3 downto 0); -時鐘的高位調(diào)整輸入端 qout : out std_logic_vector(3 downto 0) );end baoshi;architecture behave of baoshi issignal tem1:std_logic_vector(3 downto

溫馨提示

  • 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)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論