根據VHDL的多功能數字鐘設計報告_第1頁
根據VHDL的多功能數字鐘設計報告_第2頁
根據VHDL的多功能數字鐘設計報告_第3頁
根據VHDL的多功能數字鐘設計報告_第4頁
已閱讀5頁,還剩8頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、根據vhdl的多功能數字鐘設計報告基于vhdl的多功能數字鐘設計報告021215班衛(wèi)時章02121451 一、設計要求 1、具有以二十四小時制計時、顯示、整點報時、時間設置和鬧鐘的功能。2、設計精度要求為1秒。二、設計環(huán)境:quartus ii三、系統功能描述1、系統輸入:時鐘信號clk采用50mhz;系統狀態(tài)及較時、定時轉換的控制信號為k、set,校時復位信號為reset,均由按鍵信號產生。2、系統輸出:led顯示輸出;蜂鳴器聲音信號輸出。3、多功能數字電子鐘系統功能的具體描述如下:(一)計時:正常工作狀態(tài)下,每日按24h計時制計時并顯示,蜂鳴器無聲,逢整點報時。(二)校時:在計時顯示狀態(tài)下

2、,按下“k”鍵,進入“小時”待校準狀態(tài),若此時按下“set”鍵,小時開始校準;之后按下“k”鍵則進入“分”待校準狀態(tài);繼續(xù)按下“k”鍵則進入“秒”待復零狀態(tài);再次按下“k”鍵數碼管顯示鬧鐘時間,并進入鬧鐘“小時”待校準狀態(tài);再次按下“k”鍵則進入鬧鐘“分”待校準狀態(tài);若再按下“k”鍵恢復到正常計時顯示狀態(tài)。若校時過程中按下“reset”鍵,則系統恢復到正常計數狀態(tài)。(1)“小時”校準狀態(tài):在“小時”校準狀態(tài)下,顯示“小時”的數碼管以2hz 閃爍,并按下“set”鍵時以2hz的頻率遞增計數。(2)“分”校準狀態(tài):在“分”校準狀態(tài)下,顯示“分”的數碼管以2hz閃爍,并按下“set”鍵時以2hz的頻

3、率遞增計數。(3)“秒”校準狀態(tài):在“秒復零”狀態(tài)下,顯示“秒”的數碼管以2hz閃爍,并以1hz的頻率遞增計數。(4)鬧鐘“小時”校準狀態(tài):在鬧鐘“小時”校準狀態(tài)下,顯示“小時”的數碼管以2hz閃爍,并按下“set”鍵時以2hz的頻率遞增計數。(5)鬧鐘“分”校準狀態(tài):在鬧鐘“分”校準狀態(tài)下,顯示“分”的數碼管以2hz閃爍,并按下“set”鍵時以2hz的頻率遞增計數。(三)整點報時:蜂鳴器在“59”分鐘的第“51”、“53”、“55”、“57”秒發(fā)頻率為500hz的低音,在“59”分鐘的第“59”秒發(fā)頻率為1000hz的高音,結束時為整點。(四)顯示:采用掃描顯示方式驅動4個led數碼管顯示小

4、時、分,秒由兩組led燈以4位bcd 碼顯示。(五)鬧鐘:鬧鐘定時時間到,蜂鳴器發(fā)出頻率為1000hz的高音,持續(xù)時間為60秒。四、各個模塊分析說明1、分頻器模塊(freq.vhd)(1)模塊說明:輸入一個頻率為50mhz的clk,利用計數器分出1khz的q1khz,500hz的q500hz,2hz的q2hz和1hz的q1hz。(2)源程序:library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;entity freq isport (clk: in std_logic ; -輸入時鐘信號q1khz:

5、 buffer std_logic;q500hz: buffer std_logic;q2hz: buffer std_logic;q1hz: out std_logic);end freq;architecture bhv of freq isbeginp1khz:process(clk)variable cout:integer:=0;beginif clkevent and clk=1 thencout:=cout+1; -每來個時鐘上升沿時cout開始計數if coutelse cout:=0; -輸出“1”,完成1khz頻率輸出end if;end if;end process;p5

6、00hz:process(q1khz) -q1khz作為輸入信號,分出q500hz variable cout:integer:=0;beginif q1khzevent and q1khz=1 thencout:=cout+1;if cout=1 then q500hzelsif cout=2 then cout:=0;q500hzend if;end if;end process;p2hz:process(q500hz)variable cout:integer:=0;beginif q500hzevent and q500hz=1 thencout:=cout+1;if coutelsi

7、f coutelse cout:=0; end if; end if;end process;p1hz:process(q2hz)variable cout:integer:=0;beginif q2hzevent and q2hz=1 thencout:=cout+1;if cout=1 then q1hzelsif cout=2 then cout:=0;q1hzend if;end if;end process;end bhv;(3)模塊圖:2、控制器模塊(contral.vhd)(1)模塊說明:輸入端口k,set鍵來控制6個狀態(tài),這六個狀態(tài)分別是:顯示計時時間狀態(tài),調計時的時、分、秒的

8、3個狀態(tài),調鬧鈴的時、分的3個狀態(tài),reset鍵是復位鍵,用來回到顯示計時時間的狀態(tài)。(2)波形仿真圖:(3)模塊圖: 3、二選一模塊(mux21a.vhd)(1)源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity mux21a isport(a,b,s:in bit;y:out bit);end entity mux21a;architecture one of mux21a isbeginprocess(a,b,s)beginif s=0 thenyend if;end pr

9、ocess;end architecture one;(2)仿真波形圖:(3)模塊圖: 4、計時模塊 a.秒計時(second.vhd) (1)仿真波形圖:(2)模塊圖:b.分計時(minute.vhd) (1)仿真波形圖:(2)模塊圖:c.小時計時(hour.vhd) (1)仿真波形圖:(2)模塊圖: d.鬧鐘分計時(cntm60b.vhd) (1)仿真波形圖:(2)模塊圖:e.鬧鐘小時計時(cnth24b.vhd)(1)仿真波形圖:(2)模塊圖:5、鬧鐘比較模塊(compare.vhd)(1)模塊說明:比較正常計數時間與鬧鐘定時時間是否相等,若相等,compout 輸出“1”,反之輸出“0

10、”。(2)仿真波形圖: (3)模塊圖: 6、報時模塊(bell.vhd)(1)模塊說明:該模塊既實現了整點報時的功能,又實現了鬧鈴的功能,蜂鳴器通過所選頻率的不同,而發(fā)出不同的聲音。(2)仿真波形圖:(3)模塊圖:7、控制顯示模塊(show_con.vhd)(1)模塊說明:該模塊實現了數碼管既可以顯示正常時間,又可以顯示鬧鐘時間的功能;調時過程的定時閃爍功能也在此模塊中真正實現。(2)源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all; entity show_con is port(th1,

11、tm1,ts1:in std_logic_vector(7 downto 4);th0,tm0,ts0:in std_logic_vector(3 downto 0);bh1,bm1:in std_logic_vector(7 downto 4);bh0,bm0:in std_logic_vector(3 downto 0);sec1,min1,h1: out std_logic_vector(7 downto 4);sec0,min0,h0: out std_logic_vector(3 downto 0);q2hz,flashs,flashh,flashm,sel_show:in std_

12、logic);end show_con;architecture rtl of show_con isbeginprocess(th1,tm1,ts1,th0,tm0,ts0,bh1,bm1,bh0,bm0,q2hz,flashs,flashh,flashm,sel_sho w)beginif sel_show=0thenif ( flashh=1and q2hz=1)thenh1min1sec1elsif (flashm=1and q2hz=1)thenh1min1sec1elsif (flashs=1and q2hz=1)thenh1min1sec1elseh1min1sec1end if

13、;elsif sel_show=1then-若sel_show為“1”,數碼管顯示鬧鐘時間if(flashh=1 and q2hz=1)thenh1min1sec1elsif ( flashm=1 and q2hz=1)thenh1min1sec1elseh1 min1sec1end if ; end if;end process;end rtl;(3)模塊圖:8、動態(tài)掃描顯示模塊(scan_led.vhd)(1)模塊說明:由4組輸入信號和輸出信號進而實現了時鐘時、分的動態(tài)顯示。(2)源程序:library ieee;use ieee.std_logic_1164.all;use ieee.s

14、td_logic_unsigned.all;entity scan_led isport(clk1:in std_logic;h0:in std_logic_vector(3 downto 0);h1:in std_logic_vector(7 downto 4);min0:in std_logic_vector(3 downto 0);min1:in std_logic_vector(7 downto 4);ml:out std_logic_vector(7 downto 0);mh:out std_logic_vector(7 downto 0);hl:out std_logic_vect

15、or(7 downto 0);hh:out std_logic_vector(7 downto 0);end scan_led;architecture one of scan_led issignal cnt4:std_logic_vector(1 downto 0); signal a: std_logic_vector(3 downto 0) ; beginp1:process(clk1)beginif clk1event and clk1 =1 thencnt4if cnt4=3 thencnt4end if;end if;end process p1;p2:process(cnt4,h1,h0,min1,min0)begincase cnt4 is -控制數碼管位選when 00=case min0 iswhen 0000=mlwhen 0001=mlwhen 0010=mlwhen 0011=mlwhen 0100=mlwhen 0101=mlwhen 0110=mlwhen 0111=mlwhen 1000=mlwhen 100

溫馨提示

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

評論

0/150

提交評論