電子設(shè)計自動化EDA課程設(shè)計電子鐘設(shè)計_第1頁
電子設(shè)計自動化EDA課程設(shè)計電子鐘設(shè)計_第2頁
電子設(shè)計自動化EDA課程設(shè)計電子鐘設(shè)計_第3頁
電子設(shè)計自動化EDA課程設(shè)計電子鐘設(shè)計_第4頁
電子設(shè)計自動化EDA課程設(shè)計電子鐘設(shè)計_第5頁
已閱讀5頁,還剩16頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、電子設(shè)計自動化eda課程設(shè)計題目 電 子 鐘 設(shè) 計 專業(yè) 電子信息科學(xué)與技術(shù) 班級 電子一班 學(xué)號 20104672 姓名 目錄一、實(shí)驗(yàn)?zāi)康?(1)二、實(shí)驗(yàn)內(nèi)容-(1)三、工作原理-(1)四、vhdl源程序代碼-(2) 1、 分頻模塊-(2)2、走時、校時模塊-(4)3、鬧鐘模塊-(7)4、秒表模塊-(9)5、功能控制模塊-(13)6、選擇輸出模塊-(14)7、數(shù)碼管顯示、亮度可調(diào)模塊-(15)8、總體例化-(17)五、心得體會-(18)一 . 實(shí)驗(yàn)?zāi)康?練習(xí)綜合設(shè)計能力,熟練應(yīng)用quartursii軟件,熟練掌握課本知識,設(shè)計一個數(shù)字鐘,以提高自己的動手能力二. 實(shí)驗(yàn)內(nèi)容 基本功能要求 設(shè)

2、計一個電子時鐘,要求可以顯示時、分、秒,用戶可以設(shè)置時間。 擴(kuò)展功能要求 秒表功能,鬧鐘功能,調(diào)整數(shù)碼管亮度 試驗(yàn)箱設(shè)置1、 選擇模式7;2、 數(shù)碼管8左邊的跳線選擇close;三. 工作原理 數(shù)字鐘模塊分化如下: 分頻模塊功能控制模塊走時/調(diào)時選擇輸出顯示數(shù)碼管顯示、亮度可調(diào)鬧鐘選時定時比較秒表 (1) 分頻模塊可分出1hz、100 hz 、1000hz、5000 hz,分別用于正常走時、秒表、定時比較和數(shù)碼管掃描。 (2) 功能控制模塊由一個簡單加法器實(shí)現(xiàn)看,用鍵7控制,當(dāng)按一下鍵7,來一個單脈沖,加法器內(nèi)部定義信號循環(huán)自加實(shí)現(xiàn)模式轉(zhuǎn)換,不斷控制各功能模塊的使能鍵,實(shí)現(xiàn)功能轉(zhuǎn)換。 (3)

3、走時/調(diào)時模塊通過使能端選擇不同輸入時鐘,切換兩個模式,當(dāng)en=1時,可以調(diào)時,鍵4為位選鍵,鍵1為加數(shù)鍵,en=0時,正常走時。只有在調(diào)時時,走時停止,在其他功能時走時正常進(jìn)行。此模塊由時、分、秒三部分組成。 (4) 鬧鐘模塊由兩部分組成,鬧鐘選時和定時比較,選定鬧鐘時間后,在1000 hz的驅(qū)動下,比較器時刻與正常走時輸出比較,當(dāng)兩時間相等時,比較器輸出以時鐘信號使蜂鳴器發(fā)出響聲。 (5)秒表模塊由計數(shù)器實(shí)現(xiàn),鍵1為清零鍵,當(dāng)百分之一秒計滿一百進(jìn)一位,秒計滿六十進(jìn)一位??娠@示分、秒、百分之一秒。 (6)選擇輸出顯示模塊 ,由一個加法器實(shí)現(xiàn) ,此模塊與功能控制模塊為同一驅(qū)動,選擇輸出當(dāng)前功能

4、的輸出。(7)數(shù)碼管顯示、亮度可調(diào)模塊由5000hz驅(qū)動,顯示部分分為段選與位選。鍵7控制選擇到亮度調(diào)節(jié)功能,鍵1實(shí)現(xiàn)亮度調(diào)節(jié)。四. 各模塊vhdl源代碼1、分頻模塊 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity div is -分頻port(clk:in std_logic; clk1,clk100,clk1000,clk1m:out std_logic); end;architecture one of div issignal clk1_tmp:std_logic;signa

5、l clk2_tmp:std_logic;signal clk3_tmp:std_logic;signal clk4_tmp:std_logic;signal cnt1:integer range 0 to 4999999; - 1hz 正常走時signal cnt100:integer range 0 to 49999; -100hz 秒表驅(qū)動signal cnt1000:integer range 0 to 4999 ; -1000 掃描鬧鐘比較器signal cnt1m:integer range 0 to 999; -5000 掃描頻率beginp1: process(clk) beg

6、in if clkevent and clk=1 then if cnt14999999 then cnt1=cnt1+1; elsecnt1=0; clk1_tmp=not clk1_tmp ;end if;end if;end process;p2: process(clk) begin if clkevent and clk=1 then if cnt10049999 then cnt100=cnt100+1; elsecnt100=0; clk2_tmp=not clk2_tmp ;end if;end if;end process;p3: process(clk) begin if

7、clkevent and clk=1 then if cnt10004999 then cnt1000=cnt1000+1; elsecnt1000=0; clk3_tmp=not clk3_tmp ;end if;end if;end process;p4: process(clk) begin if clkevent and clk=1 then if cnt1m999 then cnt1m=cnt1m+1; elsecnt1m=0; clk4_tmp=not clk4_tmp ;end if;end if;end process;clk1=clk1_tmp;clk100=clk2_tmp

8、;clk1000=clk3_tmp;clk1m0); begin process(clk) begin if clkevent and clk=1 then if en =0 then if c19 then c1=c1+1; else c10); if c25 then c2=c2+1; else c20); end if; end if; end if; end if; if c1=9 and c2=5 then cout =1;-進(jìn)位 else cout =0; end if; cq(3 downto 0)=c1; cq(7 downto 4)0);signal clk:std_logi

9、c; begin p1:process(en) -選擇計時或調(diào)時信號 begin if en=1 then clk=(add and adjust1); else clk=clkin; end if; end process; p2: process(clk) begin if clkevent and clk=1 then -簡單計數(shù)器 if c19 then c1=c1+1; else c10); if c25 then c2=c2+1; else c20); end if; end if; end if; if c1=9 and c2=5 then cout =1;-進(jìn)位 else co

10、ut =0; end if; cq(3 downto 0)=c1; cq(7 downto 4)0);signal clk:std_logic; begin p1:process(en) -選擇計時與調(diào)時信號 begin if en=1 then clk=(add and adjust2); else clk=clkin; end if; end process; p2: process(clk) -簡單計數(shù)器 begin if clkevent and clk=1 then if c19 and c22 then c1=c1+1; elsif c1=9 and c22 then c2=c2+

11、1;c1=0000; elsif c2=2 and c13 then c1=c1+1; else c1=0000;c2=0000; end if; end if; cq(3 downto 0)=c1; cq(7 downto 4)=c2; end process;end architecture;(4)控制時、分位切換程序 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity adjust is -控制時位與分位 port (choice:in std_logic; adjust1:out

12、 std_logic; adjust2:out std_logic); end entity; architecture one of adjust is signal sel: std_logic_vector(1 downto 0); begin p1: process(choice) begin if choiceevent and choice=1 then - 位選信號 if sel1 then sel=sel+1; else sel adjust1=1;adjust2 adjust2=1;adjust1adjust2=0;adjust1clk,en=en,cq=sput,cout=

13、a); u1: mscnt60 port map(clkin =a,en=en,add=add,adjust1=c,cq=mput,cout=b); u2: hcnt24 port map (clkin=b,en=en,add=add,adjust2=d,cq=hput); u3: adjust port map (choice=select1,adjust1=c,adjust2=d);end one;end one ; 3、鬧鐘模塊(1)鬧鐘選時模塊library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all

14、;-鬧鐘選時entity xuanshi is port (add,select2,en:in std_logic; -select2選位 m_clk,h_clk,s_clk:out std_logic_vector(7 downto 0); end xuanshi; architecture one of xuanshi is signal mc1,mc2,hc1,hc2:std_logic_vector(3 downto 0); signal xuanwei :integer range 0 to 1; begin p1: process(add) begin if en=1 then i

15、f addevent and add=1 then -分位 if xuanwei=0 then if mc19 then mc1=mc1+1; else mc1=0000; if mc25 then mc2=mc2+1; else mc2=0000; end if; end if; elsif xuanwei=1 then -時位 if hc19 and hc22 then hc1=hc1+1; elsif hc1=9 and hc22 then hc2=hc2+1 ;hc1=0000; elsif hc13 and hc2=2 then hc1=hc1+1;hc2=0000; else hc

16、1=0000;hc2=0000; end if; end if; end if; end if; s_clk=00000000; -調(diào)鬧鐘時,秒輸出為零 m_clk(3 downto 0)=mc1; m_clk(7 downto 4)=mc2; h_clk(7 downto 4)=hc2; h_clk(3 downto 0)=hc1; end process; p2: process(select2) begin if select2event and select2=1 then if xuanwei 1 then xuanwei =xuanwei+1; else xuanwei=0; en

17、d if; end if; end process; end architecture;(2)鬧鐘定時比較器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity dingshi is -鬧鐘定時響 port(h_clk,h_ala,m_ala,m_clk:in std_logic_vector(7 downto 0); clk:in std_logic; -1000hz,用于檢測記時 al_out:out std_logic); -使蜂鳴器響的時鐘end entity;architectu

18、re one of dingshi issignal a:std_logic_vector(7 downto 0 );signal b:std_logic;begin process(h_clk,h_ala,m_clk,m_ala,clk) begin if clkevent and clk=1 then if h_clk=h_ala and m_clk=m_ala then - 循環(huán)自減以實(shí)現(xiàn)輸出時鐘信號 a00000000 then a=a-1; b =not b; if b=1then al_out=1; else al_out=0; end if; end if ; end if; e

19、nd process;end one;4、秒表模塊(1)百分之一秒走時library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all; entity run_s is -跑百分之一秒 port(clk,rst,en:in std_logic; m_out : out std_logic_vector(7 downto 0); ms_jw:out std_logic); end entity; architecture one of run_s is signal ms_c1,ms_c2 :std_logic_ve

20、ctor(3 downto 0); begin process(rst,clk) begin if rst=1 then ms_c1=0000;ms_c2=0000; -清零 elsif en=1 then if clkevent and clk=1 then if ms_c19 then ms_c1=ms_c1+1; else ms_c10); if ms_c29 then ms_c2=ms_c2+1; else ms_c20); end if ; end if; end if ; end if; if ms_c1=9 and ms_c2=9 then ms_jw =1;-進(jìn)位 else m

21、s_jw =0; end if; m_out(7 downto 4)=ms_c2; m_out (3 downto 0)=ms_c1; end process; end one ;(2)秒走時 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity run_ss is -跑秒 port (clk,rst,en:in std_logic; s_out :out std_logic_vector(7 downto 0); s_jw:out std_logic); -進(jìn)位 end entity;

22、architecture one of run_ss is signal s_c1,s_c2:std_logic_vector(3 downto 0); begin process(clk) begin if rst=1 then s_c1=0000;s_c2=0000; -清零 elsif en=1 then if clkevent and clk=1 then if s_c19 then s_c1=s_c1+1; else s_c10); if s_c25 then s_c2=s_c2+1; else s_c20); end if; end if; end if; end if; if s

23、_c1=9 and s_c2=5 then s_jw =1;-進(jìn)位 else s_jw =0; end if; s_out(3 downto 0)=s_c1 ; s_out(7 downto 4 )=s_c2; end process; end architecture; (3)分走時library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity run_m is -跑分 port (clk,rst,en:in std_logic; s_out :out std_logic_vector(7 dow

24、nto 0); end entity; architecture one of run_m is signal s_c1,s_c2:std_logic_vector(3 downto 0); begin process(clk) begin if rst=1 then s_c1=0000;s_c2=0000; -清零 elsif en =1 then if clkevent and clk=1 then if s_c19 then s_c1=s_c1+1; else s_c10); if s_c25 then s_c2=s_c2+1; else s_c20); end if; end if;

25、end if; end if; s_out(3 downto 0)=s_c1 ; s_out(7 downto 4 )=s_c2; end process; end architecture; library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all; entity xiao is -用加法器實(shí)現(xiàn)脈沖轉(zhuǎn)換為電平 port (stop:in std_logic; rst:out std_logic); -控制調(diào)零 end entity; architecture one of xiao is signal m

26、odel :std_logic_vector(1 downto 0); begin p1 :process(model) begin if model=1 then rst=1; elsif model=0 then rst=0; end if; end process; p2:process(stop) begin if stopevent and stop=1 then if model1 then model=model+1; else model=00; end if; end if; end process; end architecture; (4)轉(zhuǎn)換電平控制為脈沖控制libra

27、ry ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all; entity xiao is -用加法器實(shí)現(xiàn)脈沖轉(zhuǎn)換為電平 port (stop:in std_logic; rst:out std_logic); -控制調(diào)零 end entity; architecture one of xiao is signal model :std_logic_vector(1 downto 0); begin p1 :process(model) begin if model=1 then rst=1; elsif model=0 then rst=0; end if; end process; p2:process(stop) begin if stopevent and stop=1 the

溫馨提示

  • 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

提交評論