數電實驗--多功能數字鐘_第1頁
數電實驗--多功能數字鐘_第2頁
數電實驗--多功能數字鐘_第3頁
數電實驗--多功能數字鐘_第4頁
數電實驗--多功能數字鐘_第5頁
已閱讀5頁,還剩11頁未讀 繼續免費閱讀

下載本文檔

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

文檔簡介

1、-. z理工大學本科實驗報告題目:多功能數字鐘課程名稱: 數字電路課程設計學院系:電子信息與電氣工程學部專 業: 自動化 班 級: 電自0801 學生:學 號: 202181142 完成日期: 2021年7月20日 成 績:2021 年 7 月 20 日題目:多功能數字鐘1 設計要求一個具有時,分,秒的十進制數字顯示小時從0023計時器。具有手動校時,校分的功能。定時與鬧鐘功能,能在設定的時間發出鬧鈴聲能整點報時。要求從59分54秒起報時,每隔2秒發出低音,連續3次,在整點要高音。2 設計分析及系統方案設計系統總體結果系統設計要求說明:該秒表用模24、模60計數器實現24小時計時在調節鬧鐘時不

2、影響數字鐘的正常走表;在調節鬧鐘時要通過數碼管顯示出;3系統以及模塊硬件電路設計根據上述給出的系統總體構造框圖,給出系統硬件電路設計,并作必要的說明和理論計算。由于數字電路課程設計課程采用實驗箱完成,沒有學時涉及有關FPGA芯片的使用,因此有關FPGA芯片的局部可以用FPGA最小系統模塊框代替。其余接口局部按鍵,LED以及數碼管,各種接口等需要設計電路以及參數。下載時選擇的開發系統模式以及管腳定義表1 GW48-CK開發系統工作模式:模式0接口名稱類型(輸入/輸出)構造圖上的信號名引腳號說明en輸入PIO716手動校時1-調時,0-走表th輸入PIO611調時按鍵en=1,或en1=1調時en

3、1輸入PIO510鬧鐘設定1-調時,0-不走tm輸入PIO49調分按鍵en=1或en1=1,才可調分alarmstop輸入PIO38鬧鈴控制端clk輸入CLOCK142系統走表時鐘f=1Hzclk1輸入CLOCK02鬧鐘與整點報時時鐘f=256Hzclk2輸入CLOCK583整點報時時鐘時鐘f=1024Hzqhh輸出PIO47-PIO4479、78、73、72輸出小時的高位qlh輸出PIO43-PIO4071、70、67、66輸出小時的低位qhm輸出PIO39-PIO3665、64、62、61輸出分鐘的高位qlm輸出PIO35-PIO3260、59、58、54輸出分鐘的低位qhs輸出PIO31

4、-PIO2853、52、51、50輸出秒的高位qls輸出PIO27-PIO2449、48、47、39輸出秒的低位speaker輸出SPEAKER3輸出蜂鳴器的時鐘4 系統的VHDL設計系統的各個局部如何用VHDL設計出來的應該有說明,包括論述以及真值表或者狀態圖等。要求:系統或頂層文件構造描述,各個模塊或子程序的功能描述;1用原理圖實現的,需包含以下容:(1)系統原理圖(2)主要模塊或符號說明;主要模塊:模60計數器,模24計數器,2用VHDL語言實現的(1) 秒計數器模60計數器library ieee;use ieee.std_logic_1164.all;use ieee.std_log

5、ic_unsigned.all;entity m_601 is port(clk: in std_logic; clk_1: out std_logic; -clk_1表進位 qh,ql:out std_logic_vector(3 downto 0)qh,ql表示十位與個位 );end;architecture a of m_601 issignal qqh,qql: std_logic_vector(3 downto 0);signal tmp: std_logic;begin process(clk)begin if clkevent and clk=1 then if qql=9 th

6、en qql=0000; if qqh=5 then qqh=0000;tmp=1; else qqh=qqh+1; end if; else qql=qql+1; tmp=0; end if; end if;end process;qh=qqh;ql=qql;clk_1=tmp;end;秒計數器仿真圖2分計數器模60計數器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity m_60 is port(clk,en,t: in std_logic; -在en=1控制的情況下,手動t校時 c

7、lk_1: out std_logic; -clk_1表進位 qh,ql:out std_logic_vector(3 downto 0)qh,ql表十位與個位 );end;architecture a of m_60 issignal qqh,qql: std_logic_vector(3 downto 0);signal tmp,tmp_1: std_logic;begin process(tmp_1)begin if tmp_1event and tmp_1=1 then if qql=9 then qql=0000; if qqh=5 then qqh=0000;tmp=1; else

8、 qqh=qqh+1; end if; else qql=qql+1; tmp=0; end if; end if;end process;qh=qqh;ql=qql;clk_1=tmp;process(en,clk,t)beginif en=0 thentmp_1=clk;elsetmp_1=t;end if;end process;end;分計數器仿真圖3小時計數器模24計數器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity m_24 is port(clk,en,t: in st

9、d_logic; -在en=1控制的情況下,手動t校時 qh,ql:out std_logic_vector(3 downto 0)qh,ql表十位與個位 );end;architecture a of m_24 issignal tmp: std_logic;signal qqh,qql: std_logic_vector(3 downto 0);begin process(en,tmp,t)beginif en=0 thentmp=clk;elsetmp=t;end if;end process;process(tmp)begin if tmpevent and tmp=1 then if

10、 qql=9 or(qql=4 and qqh=2) then qql=0000; if qqh=2 then qqh=0000; else qqh=qqh+1; end if; else qql=qql+1; end if; end if;end process;qh=qqh;ql=qql;end;小時計數器模24計數器仿真圖鬧鐘分鐘計數器模60計數器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity m_60b is port(clk,en: in std_logic; -在en=1

11、是,手動給clk,鬧鐘加1; qh,ql:out std_logic_vector(3 downto 0) );end;architecture a of m_60b issignal qqh,qql: std_logic_vector(3 downto 0);begin process(en,clk)begin if clkevent and clk=1 then if en=1 then if qql=9 then qql=0000; if qqh=5 then qqh=0000; else qqh=qqh+1; end if; else qql=qql+1; end if; end if

12、; end if;end process;qh=qqh;ql=qql;end;鬧鐘分鐘計數器模60計數器仿真圖鬧鐘小時計數器模24計數器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity m_24b is port(clk,en: in std_logic; qh,ql:out std_logic_vector(3 downto 0) );end;architecture a of m_24b issignal qqh,qql: std_logic_vector(3 downto 0);

13、begin process(clk,en)begin if clkevent and clk=1 then if en=1 then if qql=9 or(qql=4 and qqh=2) then qql=0000; if qqh=2 then qqh=0000; else qqh=qqh+1; end if; else qql=qql+1; end if; end if; end if;end process;qh=qqh;ql=qql;end;鬧鐘小時計數器模24計數器仿真圖整個系統程序library ieee;use ieee.std_logic_1164.all;use ieee.

14、std_logic_unsigned.all;-分鐘模60計數器-entity m_60 is port(clk,en,t: in std_logic; clk_1: out std_logic; qh,ql:out std_logic_vector(3 downto 0) );end;architecture a of m_60 issignal qqh,qql: std_logic_vector(3 downto 0);signal tmp,tmp_1: std_logic;begin process(tmp_1)begin if tmp_1event and tmp_1=1 then i

15、f qql=9 then qql=0000; if qqh=5 then qqh=0000;tmp=1; else qqh=qqh+1; end if; else qql=qql+1; tmp=0; end if; end if;end process;qh=qqh;ql=qql;clk_1=tmp;process(en,clk,t)beginif en=0 thentmp_1=clk;elsetmp_1=t;end if;end process;end;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.a

16、ll;-校分模60計數器-entity m_60b is port(clk,en: in std_logic; qh,ql:out std_logic_vector(3 downto 0) );end;architecture a of m_60b issignal qqh,qql: std_logic_vector(3 downto 0);begin process(en,clk)begin if clkevent and clk=1 then if en=1 then if qql=9 then qql=0000; if qqh=5 then qqh=0000; else qqh=qqh+

17、1; end if; else qql=qql+1; end if; end if; end if;end process;qh=qqh;ql=qql;end;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;-秒表模60計數器-entity m_601 is port(clk: in std_logic; clk_1: out std_logic; qh,ql:out std_logic_vector(3 downto 0) );end;architecture a of m_601 issign

18、al qqh,qql: std_logic_vector(3 downto 0);signal tmp: std_logic;begin process(clk)begin if clkevent and clk=1 then if qql=9 then qql=0000; if qqh=5 then qqh=0000;tmp=1; else qqh=qqh+1; end if; else qql=qql+1; tmp=0; end if; end if;end process;qh=qqh;ql=qql;clk_1=tmp;end;library ieee;use ieee.std_logi

19、c_1164.all;use ieee.std_logic_unsigned.all;-校時模24計數器-entity m_24b is port(clk,en: in std_logic; qh,ql:out std_logic_vector(3 downto 0) );end;architecture a of m_24b issignal qqh,qql: std_logic_vector(3 downto 0);begin process(clk,en)begin if clkevent and clk=1 then if en=1 then if qql=9 or(qql=4 and

20、 qqh=2) then qql=0000; if qqh=2 then qqh=0000; else qqh=qqh+1; end if; else qql=qql+1; end if; end if; end if;end process;qh=qqh;ql=qql;end;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;-小時模24計數器-entity m_24 is port(clk,en,t: in std_logic; qh,ql:out std_logic_vector(3 down

21、to 0) );end;architecture a of m_24 issignal tmp: std_logic;signal qqh,qql: std_logic_vector(3 downto 0);begin process(en,tmp,t)beginif en=0 thentmp=clk;elsetmp=t;end if;end process;process(tmp)begin if tmpevent and tmp=1 then if qql=9 or(qql=4 and qqh=2) then qql=0000; if qqh=2 then qqh=0000; else q

22、qh=qqh+1; end if; else qql=qql+1; end if; end if;end process;qh=qqh;ql=qql;end;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity top4 is port(clk,clk1,clk2,en,en1,th,tm,alarmstop:in std_logic;-clk:系統走表時鐘(f=1Hz);clk1:鬧鐘與整點報時時鐘f=256Hz;clk2: 整點報時時鐘(f=1024Hz);en.en1:分別是校時、校

23、分與調鬧鈴的使能端;th,tm:是手動調節小時與分鐘的時鐘- qls,qhs,qlm,qhm,qlh,qhh:out std_logic_vector(3 downto 0);-分別表示秒低高位,分上下位,時上下位- speaker:out std_logic );speaker:是喇叭end;architecture a of top4 is ponent m_60 port(clk,en,t: in std_logic; clk_1: out std_logic; qh,ql:out std_logic_vector(3 downto 0) );end ponent; ponent m_6

24、01 port(clk: in std_logic; clk_1: out std_logic; qh,ql:out std_logic_vector(3 downto 0) );end ponent; ponent m_60b port(clk,en: in std_logic; qh,ql:out std_logic_vector(3 downto 0) );end ponent; ponent m_24 port(clk,en,t: in std_logic; qh,ql:out std_logic_vector(3 downto 0) );end ponent; ponent m_24

25、b port(clk,en: in std_logic; qh,ql:out std_logic_vector(3 downto 0) );end ponent; signal fulls,fullm:std_logic; -秒、分進位- signal:qhhtmp,qlhtmp,qhmtmp,qlmtmp,qhhaltmp,qlhaltmp,qhmaltmp, qlmaltmp,qlstmp,qhstmp:std_logic_vector(3 downto 0);-秒,分,時中間信號- signal speaker1,speaker2:std_logic; -鬧鐘與整點報時的中間信號begi

26、n u1:m_601 port map(clk,fulls,qhstmp,qlstmp); u2:m_60 port map(fulls,en,tm,fullm,qhmtmp,qlmtmp); u3:m_24 port map(fullm,en,th,qhhtmp,qlhtmp); u4:m_24b port map(th,en1,qhhaltmp,qlhaltmp); u5:m_60b port map(tm,en1,qhmaltmp,qlmaltmp); process(en1,qhhaltmp,qlhaltmp,qhmaltmp,qlmaltmp,qhhtmp,qlhtmp, qhmtm

27、p,qlmtmp) begin if en1=1 then-在鬧鐘調節時,把鬧鐘顯示的界面顯示出來并且不影響時鐘的正常走表- qhh=qhhaltmp;qlh=qlhaltmp; qhm=qhmaltmp;qlm=qlmaltmp; qhs=0000;qls=0000; else -在en=0時顯示正常走表- qhs=qhstmp;qls=qlstmp; qhh=qhhtmp;qlh=qlhtmp; qhm=qhmtmp;qlm=qlmtmp; end if; end process; -鬧鐘-process(alarmstop,qhhaltmp,qlhaltmp,qhmaltmp,qlmaltmp,qhhtmp,qlhtmpqhmtmp,qlmtmp), -當到預設時間時別且alarmstop=0是每隔2秒響一次- begin if qhhaltmp=qhhtmp and qlhaltmp=qlhtmp and qhmaltmp=qhmtmp and qlmaltmp=qlmtmp and (qlstmp=1 or qlstmp=3 or qlstmp=5 or qlstmp=7 or qlstmp=9) then if alarmstop=0 then speaker2=clk1; else sp

溫馨提示

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

評論

0/150

提交評論