多功能數(shù)字電子鐘_第1頁(yè)
多功能數(shù)字電子鐘_第2頁(yè)
多功能數(shù)字電子鐘_第3頁(yè)
多功能數(shù)字電子鐘_第4頁(yè)
多功能數(shù)字電子鐘_第5頁(yè)
已閱讀5頁(yè),還剩22頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、 | STYLEREF 1 整體電路圖如下 課程設(shè)計(jì)報(bào)告設(shè)計(jì)題目: 多功能數(shù)字電子鐘 所屬院系: 計(jì)算機(jī)與控制工程學(xué)院 專 業(yè): 軟件工程 班 級(jí):133-1 小組成員:劉壯謝磊張慧慧指導(dǎo)教師: 沈春華 設(shè)計(jì)要求 進(jìn)行正常的時(shí)、分、秒計(jì)時(shí)功能,二十四小時(shí)制計(jì)時(shí)由數(shù)碼管顯示24h、60min、60s設(shè)置時(shí)間整點(diǎn)報(bào)時(shí)鬧鐘功能設(shè)計(jì)實(shí)現(xiàn)功能該數(shù)字電子鐘能夠?qū)崿F(xiàn)時(shí)、分、秒計(jì)時(shí)功能;校準(zhǔn)時(shí)和分的功能;校準(zhǔn)時(shí)間時(shí)秒清零的功能;整點(diǎn)報(bào)時(shí)的功能;各個(gè)設(shè)計(jì)模塊描述計(jì)時(shí)模塊秒計(jì)數(shù)是由一個(gè)六十進(jìn)制的計(jì)數(shù)器構(gòu)成,生成元器件如下Clk:驅(qū)動(dòng)秒計(jì)時(shí)器的時(shí)鐘信號(hào) Clr:校準(zhǔn)時(shí)間時(shí)清零的輸入端 En:使能端 Sec03.0

2、sec13.0:秒的高位顯示,低位顯示 Co:進(jìn)位輸出端,作為分的clk輸入代碼如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity second isport (clk,clr,en:in std_logic; sec0,sec1:out std_logic_vector(3 downto 0);co:out std_logic);end second;architecture sec of second isSIGNAL cnt1,cnt0:std_logic_vector(3

3、downto 0);beginprocess(clk)beginif(clr=0)thencnt0=0000;cnt1=0000;elsif(clkevent and clk=1)thenif(en=1)thenif cnt1=0101 and cnt0=1000 thenco=1;cnt0=1001;elsif cnt01001 thencnt0=(cnt0+1);else cnt0=0000;if cnt10101thencnt1=cnt1+1;else cnt1=0000;co=0;end if;end if;end if;end if;sec1=cnt1;sec0=cnt0;end p

4、rocess;end sec;仿真圖如下:2分計(jì)數(shù)是由六十進(jìn)制的計(jì)數(shù)器構(gòu)成,生成元器件如下Clk:設(shè)置分輸入和秒進(jìn)位的或輸入 En:使能輸入 Min13.0 min03.0:分的高位顯示,低位顯示 Co:向時(shí)的進(jìn)位輸出代碼如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity minute isport (clk,en:in std_logic; min1,min0:out std_logic_vector(3 downto 0);co:out std_logic);end minut

5、e;architecture min of minute isSIGNAL cnt1,cnt0:std_logic_vector(3 downto 0);beginprocess(clk)beginif(clkevent and clk=1)thenif en=1 thenif cnt1=0101 and cnt0=1001 thenco=1;cnt0=0000;cnt1=0000;elsif cnt01001 thencnt0=(cnt0+1);else cnt0=0000;cnt1=cnt1+1;co=0;end if;end if;end if;min1=cnt1;min0=cnt0;e

6、nd process;end min;仿真圖如下:3時(shí)計(jì)數(shù)是由二十四進(jìn)制的計(jì)數(shù)器構(gòu)成,生成元器件如下Clk:設(shè)置時(shí)間輸入和分進(jìn)位輸入的或en:使能端h13.0 h03.0:時(shí)的高位顯示和低位顯示代碼如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity hour isport(clk,en:in std_logic;h1,h0:out std_logic_vector(3 downto 0);end hour;architecture beha of hour issignal cnt

7、1,cnt0:std_logic_vector(3 downto 0);beginprocess(clk)beginif(clkevent and clk=1) thenif en=1 thenif cnt1=0010 and cnt0=0011 thencnt1=0000;cnt0=0000;elsif cnt01001 thencnt0=cnt0+1;elsecnt0=0000;cnt1=cnt1+1;end if;end if;end if;h1=cnt1;h0=cnt0;end process;end beha;仿真圖如下:設(shè)置時(shí)間模塊按鍵去抖動(dòng),生成元器件如下Clk:256hz頻率輸

8、入Reset:接GNDDin:接按鍵Dout:輸出傳給按鍵選擇器代碼如下library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity debounce isport(clk,reset:in std_logic; -200HZdin:in std_logic;dout:out std_logic);end debounce;architecture a of debounce istype state is(s0,s1,s2);signal

9、 current:state;beginprocess(clk,reset,din)beginif(reset=1)thencurrent=s0;doutdout=1;if(din=0)thencurrent=s1;else currentdout=1;if(din=0)thencurrent=s2;else currentdout=0;if(din=0)thencurrent=s2;else currentdout=1;current=s0;end case;end if;end process;end a;仿真圖如下:按鍵選擇器,生成元器件如下:Clk:16hz輸入Key1:按鍵調(diào)分的輸入

10、Key2:按鍵調(diào)時(shí)的輸入Key3:按鍵秒清零的輸入Led1:輸出信號(hào)給分元器件Led2:輸出信號(hào)給時(shí)元器件Led3:輸出清零信號(hào)給秒元器件代碼如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity ctr1 isport(clk:in std_logic; -10HZkey1,key2,key3,key4:in std_logic;led1,led2,led3,led4:out std_logic);end ctr1;archi

11、tecture a of ctr1 isbeginprocess (clk)beginif(clkevent and clk=1)thenif(key1=0)thenled1=1;led2=0;led3=0;led4=0;elsif(key2=0)thenled1=0;led2=1;led3=0;led4=0;elsif(key3=0)thenled1=0;led2=0;led3=1;led4=0;elsif(key4=0)thenled1=0;led2=0;led3=0;led4=1;elseled1=0;led2=0;led3=0;led4=0;end if;end if;end proc

12、ess;end a;仿真圖如下:整點(diǎn)報(bào)時(shí)模塊生成元器件如下:Clk1:接512hzClk2 clk:En:使能輸入M13.0 m03.0:接分的高位輸出和低位輸出S13.0 s03.0:接秒的高位輸出和低位輸出Speaker:連接蜂鳴器代碼如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity xiang isport(m1,m0,s1,s0:in std_logic_vector(3 downto 0); en,clk1,clk2,clk:in std_logic; speaker:

13、out std_logic);end xiang;architecture sss_arc of xiang is begin process(clk,clk1,clk2,m1,m0,s1,s0) beginif(en=1)thenspeaker=clk;elsif(m1=0101and m0=1001)thenif(s1=0101)thenif(s0=1001)thenspeaker=clk2;-1024HZelsif(s0=0001 or s0=0011 or s0=0101 or s0=0111)thenspeaker=clk1;-512HZend if;elsespeaker=0;en

14、d if;elsif(m01001 or m10101or s10101)thenspeaker=0;end if; end process;end sss_arc;仿真圖如下:顯示時(shí)間模塊模八的器件控制八個(gè)數(shù)碼管顯示的循環(huán),生成元器件如下Clk:輸入Clr:接GNDEn:使能端Y2.0:輸出接數(shù)碼管三個(gè)接受端代碼如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity mo8 isport(clr,clk,en:in std_logic;y:out std_logic_vector(2

15、 downto 0);end mo8;architecture beha of mo8 issignal p:std_logic_vector(2 downto 0);beginprocess(clk)beginif clkevent and clk=1 thenif en=1 thenif p=111 thenp=000;elsif p111 thenp=p+1;end if;end if;end if;yyyyyyyyyyyyyyyyyyyyy=1000000;end case;end process;end beha;仿真圖如下:(五)分頻模塊分頻器生成的元器件如下:Clk:時(shí)鐘輸入Cl

16、k512:512hz給響鈴模塊Clk1:1hz輸出給秒計(jì)數(shù)器Clk16:16hz輸出給按鍵選擇器Clk256:256hz輸出給按鍵抖動(dòng)代碼如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fenpin is port(clk:in std_logic; - q:out std_logic_vector(9 downto 0); clk512,clk4,clk1,clk16,clk256:out std_logic);end fenpin;architecture behave o

17、f fenpin issignal y:std_logic_vector(9 downto 0);begin process(clk) begin if(clk=1)then if(y=1111111111)then y=0000000000; clk512=y(0); clk256=y(1); clk16=y(5); clk4=y(7); clk1=y(9); else y=y+1; clk512=y(0); clk256=y(1); clk16=y(5); clk4=y(7); clk1=y(9); end if; end if; end process;end behave;仿真圖如下:

18、鬧鐘模塊比較器,比較當(dāng)時(shí)顯示時(shí)間與設(shè)置的鬧鐘時(shí)間是否相等,如相等,輸出信號(hào)給蜂鳴器。生成元器件如下:Clk clk1:使能輸入H03.0 h13.0:鬧鐘設(shè)置時(shí)間的分輸入H33.0 h23.0:鬧鐘設(shè)置時(shí)間的時(shí)輸入S03.0 s13.0:現(xiàn)在時(shí)間的分的輸入S23.0 s33.0:現(xiàn)在時(shí)間的時(shí)的輸入Y:輸出信號(hào)給蜂鳴器代碼如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity bijiao2 isport (clk,clk1:in std_logic; h0,h1,h2,h3,s0,s1,s2,s3:in std_logic_vector(3 downto 0);y:out std_logic);end bijiao2;architecture min of bijiao2 issignal c:std_logic;beginprocess(clk,clk1,h0,h1

溫馨提示

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

最新文檔

評(píng)論

0/150

提交評(píng)論