檢測與轉(zhuǎn)換技術(shù)課程設(shè)計報告書_第1頁
檢測與轉(zhuǎn)換技術(shù)課程設(shè)計報告書_第2頁
檢測與轉(zhuǎn)換技術(shù)課程設(shè)計報告書_第3頁
檢測與轉(zhuǎn)換技術(shù)課程設(shè)計報告書_第4頁
檢測與轉(zhuǎn)換技術(shù)課程設(shè)計報告書_第5頁
已閱讀5頁,還剩18頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、摘 要 人類社會已進(jìn)入到高度發(fā)達(dá)的信息社會。信息化社會的發(fā)展離不開電子信息產(chǎn)品開發(fā)技術(shù)、產(chǎn)品品質(zhì)的提高和進(jìn)步。電子信息產(chǎn)品隨著科學(xué)技術(shù)的進(jìn)步,其電子器件和設(shè)計方法更新?lián)Q代的速度日新月異。實現(xiàn)這種進(jìn)步的主要原因就是電子設(shè)計技術(shù)和電子制造技術(shù)的發(fā)展,其核心就是電子設(shè)計自動化(EDA,ElectronicsDesignAutomation)技術(shù),EDA技術(shù)的發(fā)展和推廣應(yīng)用又極大地推動了電子信息產(chǎn)業(yè)的發(fā)展。為保證電子系統(tǒng)設(shè)計的速度和質(zhì)量,適應(yīng)“第一時間推出產(chǎn)品”的設(shè)計要求,EDA技術(shù)正逐漸成為不可缺少的一項先進(jìn)技術(shù)和重要工具。目前,在國內(nèi)電子技術(shù)教學(xué)和產(chǎn)業(yè)界的技術(shù)推廣中已形成“EDA熱”,完全可以說,

2、掌握EDA技術(shù)是電子信息類專業(yè)學(xué)生、工程技術(shù)人員所必備的基本能力和技能。關(guān)鍵詞:數(shù)字鐘 EDA VHDL語言數(shù)字時鐘的設(shè)計實現(xiàn)設(shè)計實驗一、設(shè)計目的1、熟練地運(yùn)用數(shù)字系統(tǒng)的設(shè)計方法進(jìn)行數(shù)字系統(tǒng)設(shè)計;2、能進(jìn)行較復(fù)雜的數(shù)字系統(tǒng)設(shè)計;3、按要求設(shè)計一個數(shù)字鐘。二、設(shè)計內(nèi)容2.1設(shè)計任務(wù)及目標(biāo)要求設(shè)計一個數(shù)字鐘完,完成具體如下任務(wù):(1)能顯示年、月、日、時、分、秒功能;(2)具有日期和星期顯示功能;(3)具備鬧鐘功能及定點報時;(4)具備調(diào)時、定時功能。三、系統(tǒng)方案及設(shè)計原理3.1方案設(shè)計數(shù)字計時器基本功能是計時,因此首先需要獲得具有精確振蕩時間的脈振信號,以此作為計時電路的時序基礎(chǔ),實驗中可以使用

3、的振蕩頻率源為48MHZ,通過分頻獲得所需脈沖頻率(1Hz,1KHz,2KHz)。為產(chǎn)生秒位,設(shè)計一個模60計數(shù)器,對1HZ的脈沖進(jìn)行秒計數(shù),產(chǎn)生秒位;為產(chǎn)生分位,通過秒位的進(jìn)位產(chǎn)生分計數(shù)脈沖,分位也由模60計數(shù)器構(gòu)成;為產(chǎn)生時位,用一個模24計數(shù)器對分位的進(jìn)位脈沖進(jìn)行計數(shù)。整個數(shù)字計時器的計數(shù)部分共包括六位:時十位、時個位、分十位、分個位、秒十位和秒個位。顯示功能是通過數(shù)選器、譯碼器、碼轉(zhuǎn)換器和7段顯示管實現(xiàn)的。因為實驗中只用一個譯碼顯示單元,7個7段碼(6個用于顯示時分秒,一個顯示星期),所以通過4個7選一MUX和一個3-8譯碼器配合,根據(jù)計數(shù)器的信號進(jìn)行數(shù)碼管的動態(tài)顯示。清零功能是通過控

4、制計數(shù)器清零端的電平高低來實現(xiàn)的。只需使清零開關(guān)按下時各計數(shù)器的清零端均可靠接入有效電平(本實驗中是低電平),而清零開關(guān)斷開時各清零端均接入無效電平即可。校分校時功能由防抖動開關(guān)、邏輯門電路實現(xiàn)。其基本原理是通過邏輯門電路控制分計數(shù)器的計數(shù)脈沖,當(dāng)校分校時開關(guān)斷開時,計數(shù)脈沖由低位計數(shù)器提供;當(dāng)按下校分校時開校分校時功能由防抖動開關(guān)、邏輯門電路實現(xiàn)。其基本原理是通過邏輯門電路控制分計數(shù)器的計數(shù)脈沖,當(dāng)校分校時開關(guān)斷開時,計數(shù)脈沖由低位計數(shù)器提供;當(dāng)按下校分校時開通時,既可以手動觸發(fā)出發(fā)式開關(guān)給進(jìn)位脈沖,也可以有恒定的1Hz脈沖提供恒定的進(jìn)位信號,計數(shù)器在此脈沖驅(qū)動下可快速計數(shù)。為實現(xiàn)可靠調(diào)時,

5、采用防抖動開關(guān)(由D觸發(fā)器實現(xiàn))克服開關(guān)接通或斷開過程中產(chǎn)生的一串脈沖式振動。本實驗中為節(jié)省按鍵,鬧鐘時間調(diào)節(jié)鍵復(fù)用正常調(diào)時的校時校分開關(guān),為使設(shè)定鬧鈴與正常計時中調(diào)節(jié)時間按鍵互不影響,額外用一個鬧鐘使能鍵,按下該鍵后進(jìn)入鬧鐘設(shè)定界面,此時校時校分開關(guān)用于調(diào)節(jié)鬧鐘時間,對正常計時沒有影響,且此時7段顯示碼顯示的是鬧鐘時間;恢復(fù)使能鍵后校分校時鍵用于對數(shù)字鐘進(jìn)行時間調(diào)節(jié),對設(shè)定的鬧鐘時間沒有影響。整點報時功能可以通過組合邏輯電路實現(xiàn)。當(dāng)計數(shù)器的各位呈現(xiàn)特定的電平時,可以選通特定的與門和或門,將指定的頻率信號送入蜂鳴器中,實現(xiàn)在規(guī)定的時刻以指定頻率發(fā)音報時。鬧鐘設(shè)定功能。鬧鐘只設(shè)定時和分,基本模塊

6、與正常計時電路里的校時校分電路相同。本實驗中為節(jié)省按鍵,鬧鐘時間調(diào)節(jié)鍵復(fù)用正常調(diào)時的校時校分開關(guān),為使設(shè)定鬧鈴與正常計時中調(diào)節(jié)時間按鍵互不影響,額外用一個鬧鐘使能鍵,按下該鍵后進(jìn)入鬧鐘設(shè)定界面,此時校時校分開關(guān)用于調(diào)節(jié)鬧鐘時間,對正常計時沒有影響,且此時7段顯示碼顯示的是鬧鐘時間;恢復(fù)使能鍵后校分校時鍵用于對數(shù)字鐘進(jìn)行時間調(diào)節(jié),對設(shè)定的鬧鐘時間沒有影響。3.2數(shù)字鐘設(shè)計思路結(jié)構(gòu)框圖控制單元使能信號數(shù)字時鐘CLK時鐘信號報警(鬧鈴)信號復(fù)位信號輸出信號LED顯示揚(yáng)聲器四、數(shù)字電路基本模塊4.1分頻器模塊(1)模塊說明:輸入一個頻率為50MHz的CLK,利用計數(shù)器分出1KHz的q1KHz,500H

7、z的q500Hz,2Hz的q2Hz和1Hz的q1Hz。(2)源程序:LIBRARY ieee; USE ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;ENTITY fdiv IS PORT (CLK: IN STD_LOGIC ; -輸入時鐘信號 q1KHz: BUFFER STD_LOGIC; q500Hz: BUFFER STD_LOGIC; q2Hz: BUFFER STD_LOGIC; q1Hz: OUT STD_LOGIC);END fdiv ; ARCHITECTURE bhv OF fdiv IS BEGIN P

8、1KHZ:PROCESS(CLK)VARIABLE cout:INTEGER:=0;BEGIN IF CLKEVENT AND CLK=1 THEN cout:=cout+1; -每來個時鐘上升沿時cout開始計數(shù)IF cout=25000 THEN q1KHz=0; -當(dāng)cout=25000時,q1KHz輸出“0” ELSIF cout50000 THEN q1KHz=1; -當(dāng)25000cout=50000時,q1KHz ELSE cout:=0; -輸出“1”,完成1KHz頻率輸出END IF; END IF; END PROCESS; P500HZ:PROCESS(q1KHz) -q1

9、KHz作為輸入信號,分出q500HzVARIABLE cout:INTEGER:=0;BEGINIF q1KHzEVENT AND q1KHz=1 THENcout:=cout+1;IF cout=1 THEN q500Hz=0; -二分頻 ELSIF cout=2 THEN cout:=0;q500Hz=1;END IF; END IF; END PROCESS;P2HZ:PROCESS(q500Hz)VARIABLE cout:INTEGER:=0;BEGINIF q500HzEVENT AND q500Hz=1 THENcout:=cout+1;IF cout=125 THEN q2Hz

10、=0; ELSIF cout250 THEN q2Hz=1; ELSE 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 q1Hz=0; ELSIF cout=2 THEN cout:=0;q1Hz=1;END IF; END IF; END PROCESS;END bhv;(3)模塊圖:4.2控制器模塊(1)模塊說明:輸入端口enset,k,set鍵來控制6個狀態(tài),

11、這六個狀態(tài)分別是顯示計時時間狀態(tài),調(diào)計時的時、分、秒狀態(tài),調(diào)鬧鈴的時、分的狀態(tài),reset鍵是復(fù)位鍵,用來回到顯示計時時間的狀態(tài)。(2)源程序:library ieee;use ieee.std_logic_1164.all;entity contl is port(clk,enset,k,set,reset:in std_logic; cth,ctm,cts,cbh,cbm,flashh,flashm,flashs,sel_show:out std_logic);end contl;architecture rtl of contl is type stats is (s0,s1,s2,s3

12、,s4,s5); -定義6個狀態(tài) signal current_state,next_state:stats:=s0;begin process(clk,reset) begin if reset=1 then current_state=s0; elsif clkevent and clk=1 then if reset=0 then current_statecth=0;ctm=0;cts=0;cbh=0;cbm=0; flashh=0;flashm=0;flashs=0;sel_show=0; if (enset=1 and k=1)then -若enset和k為“1”, next_st

13、ate=s1; -由s0態(tài)轉(zhuǎn)到s1態(tài) else next_statectm=0;cts=0;cbh=0;cbm=0; flashh=1;flashm=0;flashs=0;sel_show=0; if set=1 then cth=1; -若set為“1”,cth輸出“1” else cth=0; -進(jìn)入調(diào)小時狀態(tài)。 end if; if (enset=1 and k=0)then -若enest為“1”,k為“0”, next_state=s2; -由s1態(tài)轉(zhuǎn)到s2態(tài) else next_statecth=0;cts=0;cbh=0;cbm=0; flashh=0;flashm=1;flas

14、hs=0;sel_show=0; if set=1 then ctm=1; else ctm=0; end if; if(enset=1 and k=1)then next_state=s3; else next_statecth=0;ctm=0;cbh=0;cbm=0; flashh=0;flashm=0;flashs=1;sel_show=0; if set=1 then cts=1; else cts=0; end if; if (enset=1 and k=0)then next_state=s4; else next_statecth=0;ctm=0;cts=0;cbm=0; fla

15、shh=1;flashm=0;flashs=0;sel_show=1; if set=1 then cbh=1; else cbh=0; end if; if(enset=1 and k=1)then next_state=s5; else next_statecth=0;ctm=0;cts=0;cbh=0; flashh=0;flashm=1;flashs=0;sel_show=1; if set=1 then cbm=1; else cbm=0; end if; if(enset=1 and k=0)then next_state=s0; else next_state=s5; end i

16、f; end case; end process;end rtl;(3)仿真波形圖:(4)模塊圖:4.3二選一模塊(1)源程序:ENTITY mux21a ISPORT(a,b,s:IN BIT; y:OUT BIT);END ENTITY mux21a;ARCHITECTURE one OF mux21a ISBEGIN PROCESS(a,b,s)BEGINIF s=0 THEN y=a;ELSE -若s=0,y輸出a,反之輸出b。y=b;END IF;END PROCESS;END ARCHITECTURE one;(2)仿真波形圖:(3)模塊圖:4.4計時模塊4.4.1秒計時模塊(1)

17、源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith;entity cnts60 is port(sld0:buffer std_logic_vector(3 downto 0); -小時個位 sld1:buffer std_logic_vector(7 downto 4); -小時十位 co: out std_logic; rest:in std_logic; clk :in std_logic);end cnts60;architecture

18、 rtl of cnts60 is begin process(clk,rest) begin if rest=1 then sld1=0000; sld0=0000; elsif (clkevent and clk=1) then if (sld1=0101and sld0=1001)then -當(dāng)sld1=5,sld0=9時 sld1=0000; sld0=0000;co=1;-全清零,co輸出“1” elsif sld0=1001 then sld0=0000; sld1=sld1+1;co=0; - sld1自加“1” else sld0=sld0+1;co=0; end if; en

19、d if; end process;end rtl;(2)仿真波形圖:(3)模塊圖:4.4.2分計時(1)源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith;entity cnt60 is port(sld0:buffer std_logic_vector(3 downto 0); sld1:buffer std_logic_vector(7 downto 4); co: out std_logic; clk :in std_logic);en

20、d cnt60;architecture rtl of cnt60 is begin process(clk) begin if (clkevent and clk=1) then if (sld1=0101and sld0=1001)then sld1=0000; sld0=0000;co=1; elsif sld0=1001 then sld0=0000; sld1=sld1+1;co=0; else sld0=sld0+1;co=0; end if; end if; end process;end rtl;(2)仿真波形圖:(3)模塊圖:4.4.3小時計時(1)源程序:library i

21、eee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith;entity cnt24 is port(sld0:buffer std_logic_vector(3 downto 0); sld1:buffer std_logic_vector(7 downto 4); clk :in std_logic);end cnt24;architecture rtl of cnt24 is signal s:std_logic_vector(7 downto 0);begin proc

22、ess(clk) begin s=sld1&sld0; if (clkevent and clk=1) then if s=then sld1=0000; sld0=0000; elsif sld0=1001 then sld0=0000; sld1=sld1+1; else sld0=sld0+1; end if; end if; end process;end rtl;(2)仿真波形圖:(3)模塊圖:4.4.4鬧鐘分計時(1)源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ie

23、ee.std_logic_arith;entity cntm60b is port(sld0:buffer std_logic_vector(3 downto 0); sld1:buffer std_logic_vector(7 downto 4); en:in std_logic; clk :in std_logic);end cntm60b;architecture rtl of cntm60b is begin process(clk) begin if (clkevent and clk=1) then if en=1 then if (sld1=0101and sld0=1001)t

24、hen sld1=0000; sld0=0000; elsif sld0=1001 then sld0=0000; sld1=sld1+1; else sld0=sld0+1; end if; end if; end if; end process;end rtl;(2)仿真波形圖:(3)模塊圖:4.4.5鬧鐘小時計時(1)源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith;entity cnth24b is port(sld0:buffer

25、std_logic_vector(3 downto 0); sld1:buffer std_logic_vector(7 downto 4); en:in std_logic; clk :in std_logic);end cnth24b;architecture rtl of cnth24b is signal s:std_logic_vector(7 downto 0);begin process(clk,en,sld1,sld0) begin s=sld1&sld0; if (clkevent and clk=1) then if en=1 then if s=then sld1=000

26、0; sld0=0000; elsif sld0=1001 then sld0=0000; sld1=sld1+1; else sld0=sld0+1; end if; end if; end if; end process;end rtl;(2)仿真波形圖:(3)模塊圖:4.5鬧鐘比較模塊(1)模塊說明:比較正常計數(shù)時間與鬧鐘定時時間是否相等,若相等,compout輸出“1”,反之輸出“0”。(2)源程序:library ieee;use ieee.std_logic_1164.all;entity comp is port(th1,tm1:in std_logic_vector(7 dow

27、nto 4); th0,tm0: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); compout:out std_logic);end comp;architecture rtl of comp isbegin process(th1,tm1,bh1,bm1,th0,tm0,bh0,bm0) begin if( th1=bh1 and tm1=bm1 and th0=bh0 and tm0=bm0 ) then co

28、mpout=1;-當(dāng)正常計數(shù)時間與鬧鐘定時時間相等時compout輸出1 else compout=0; end if; end process;end rtl;(3)仿真波形圖:(4)模塊圖:4.6報時模塊(1)模塊說明:該模塊既實現(xiàn)了整點報時的功能,又實現(xiàn)了鬧鈴的功能,蜂鳴器通過所選頻率的不同,而發(fā)出不同的聲音。(2)源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity bel is port(tm1,ts1:in std_logic_vector(7 downto 4); t

29、m0,ts0:in std_logic_vector(3 downto 0); compout,q1KHz,q500Hz,openbel:in std_logic; bell:out std_logic);end bel;architecture rtl of bel is signal t:std_logic_vector(7 downto 0);begin process(compout,q500Hz,q1KHz,openbel,tm1,tm0,ts1,ts0) begin if (openbel =0 ) then bell=0; end if; if (openbel =1 ) the

30、n if (compout=1) then - compout=1,鬧鈴響 bellbellbellbellbellbellbell=0; end case; else bell=0; end if; end if; end process;end rtl;(3)仿真波形圖:(4)模塊圖:4.7控制顯示模塊(1)模塊說明:該模塊實現(xiàn)了數(shù)碼管既可以顯示正常時間,又可以顯示鬧鐘時間的功能;調(diào)時,定時閃爍功能也在此模塊中真正實現(xiàn)。(2)源程序:library ieee;use ieee.std_logic_1164.all;entity show_con is port(th1,tm1,ts1:in

31、 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_logi

32、c);end show_con;architecture rtl of show_con isbegin process(th1,tm1,ts1,th0,tm0,ts0,bh1,bm1,bh0,bm0,q2Hz,flashs,flashh,flashm,sel_show) begin if sel_show=0then if ( flashh=1and q2Hz=1)then h1=1111;h0=1111; -顯示小時數(shù)碼管以2Hz閃爍 min1=tm1;min0=tm0; sec1=ts1;sec0=ts0; elsif (flashm=1and q2Hz=1)then h1=th1;h0

33、=th0; min1=1111;min0=1111; sec1=ts1;sec0=ts0; elsif (flashs=1and q2Hz=1)then h1=th1;h0=th0; min1=tm1;min0=tm0; sec1=1111;sec0=1111; else h1=th1;h0=th0; min1=tm1;min0=tm0; sec1=ts1;sec0=ts0; end if; elsif sel_show=1then-若sel_show為“1”,數(shù)碼管顯示鬧鐘時間 if(flashh=1 and q2Hz=1)then h1=1111;h0=1111; min1=bm1;min

34、0=bm0; sec1=0000;sec0=0000; elsif ( flashm=1 and q2Hz=1)then h1=bh1;h0=bh0; min1=1111;min0=1111; sec1=0000;sec0=0000; else h1=bh1;h0=bh0; min1=bm1;min0=bm0; sec1=0000;sec0=0000; end if ; end if; end process;end rtl;(3)模塊圖:4.8動態(tài)掃描顯示模塊(1)模塊說明:由6組輸入信號和7個數(shù)據(jù)輸出信號和8個位選通信號來實現(xiàn)數(shù)碼管的驅(qū)動和信號掃描,進(jìn)而實現(xiàn)了時鐘時,分,秒的動態(tài)顯示。(2

35、)源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_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); sec0:in std_logic_vector(3 downto 0); sec1:in std_logic_vector(7 downto 4); daout:out std_logic_vector(6 downto 0); se:out std_logic_vector(2 downto 0);end;architecture one of SCAN_LED issignal cnt6:std_logic_vector(2 downto 0);signa

溫馨提示

  • 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

提交評論