EDA电子钟多功能数字时钟课程设计含代码优秀_第1页
EDA电子钟多功能数字时钟课程设计含代码优秀_第2页
EDA电子钟多功能数字时钟课程设计含代码优秀_第3页
EDA电子钟多功能数字时钟课程设计含代码优秀_第4页
EDA电子钟多功能数字时钟课程设计含代码优秀_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、多功能数字时钟设计说明:.系统顶层框图:各模块电路功能如下:.秒计数器、分计数器、时计数器组成最基本的数字钟,其计数输出送7段译 码电路由数码管显示.基准频率分频器可分频出标准的1HZ频率信号用于秒计数的时钟信号;分 频出4HZ频率信号用于校时、校分的快速递增信号;分频出64HZ频率信号用于 对按动“校时”,“校分”按键的消除抖动.多功能数字钟结构框图:校I(校分J 5IiJ设A,一、系统功能概述已完成功能.完成时/分/秒的依次显示并正确计数,利用六位数码管显示;.时/分/秒各段个位满10正确进位,秒/分能做到满60向前进位,有系统时 间清零功能;.定时器:实现整点报时,通过扬声器发出高低报时

2、声音;.时间设置,也就是手动调时功能:当认为时钟不准确时,可以分别对分/时钟 进行调整;.闹钟:实现分/时闹钟设置,在时钟到达设定时间时通过扬声器响铃.有静音模 式.待改进功能:.系统没有万年历功能,正在思考设计方法.应添加秒表功能.二、系统组成以及系统各部分的设计1.时计数模块时计数模块就是一个2位10进制计数器,记数到23清零.VHDL的RTL描述如下: cnt_h.vhdlibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt_h isport(en,clk,clr:in std

3、_logic;dout:out std_logic_vector(7 downto 0);c:out std_logic);end cnt_h;architecture rtl of cnt_h issignal t:std_logic_vector(7 downto 0);beginprocess(en,clk,clr)variable t:std_logic_vector(7 downto 0);beginif en=1 then-异步使能if clk event and clk=1 thent:=t+1;if t(3 downto 0)=XA then-个位等于 10 则十位加 1t(7

4、 downto 4):=t(7 downto 4)+1;t(3 downto 0):=X0;-个位清零end if;if tX23 then-大于 23 清零t:二X00;end if;end if;if clr=1 then-异步清零t:二X00;end if;end if;dout=t;end process; end rtl;时计数器模块仿真波形如下LlaneYalne20.7p ps40.0 ns60.0 ns J120.0 ns 1GD.0 us200.0 ns 240. D ns20(卜A i旦:A A 丁丁回 H C酬/咐:加二迎疑 ms炉炉炉守守阳阳;B口&从仿真波形可知,当计

5、数到23时,下一个时钟上升沿到来时就清零了,符合设计要求.时计数模块框图如下di:njt7.Li*4*工*力*力丁呷多: r:rit h.分及秒计数模块分及秒计数模块也是一个2位10进制计数器,记数到59清零.VHDL的RTL描述如下: library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt_s isport(en,clk,clr:in std_logic;dout:buffer std_logic_vector(7 downto 0);c:out std_logic);end cn

6、t_s;architecture rtl of cnt_s isbeginprocess(en,clk,clr)beginif en=1 thenif clr=1 then-异步清零dout=X00;elsif clk event and clk=1 then if dout(3 downto 0)9 then dout(3 downto 0)=dout(3 downto 0)+1;c=0;elsif dout(7 downto 4)5 thendout(3 downto 0)=X0;dout(7 downto 4)=dout(7 downto 4)+1;elsedout=X00;c=1;en

7、d if;end if;else dout10 then dout=1;t:=t-1; else dout=0;end if;end if;else dout=0;t:=0;end if;end process;end rtl;Node Name /DirectionLocaUon1,0 Bd! kvref GroupIjo 5ta iJdrd beepUnkroAnPN_1743S3JI03.3-V LVTTL (default)2O didUnkra八nPN2B1B1JJ13.3-V LVTTL (deFault)a0 cbdtDLinkroAnP1N_131bi jia3.3-v lvt

8、tl (default)q6 cbutlUnkroAnPN_141Sl_N03.3-V LVTFL (default)5O dout UnkncMnPN_151B1_NO3.3-V IVTTL (deFault)6 cbjt3UnkroAnPIN61Bl jia3.3-V LVTTL (default)7C dcut 网UnkroAnP1NJ71Ed口3.37 LVTIL (default)aO ut5UnkroAnP1N_1B1B1_NQ3.3-V LVTTL (default)g dcut&UnkroAnP1NJ91Bl jia3.3-V LVTTL (default)10 dout Ll

9、nkTOMIPN_ZD1Eil JIO3.3-v lvttl (defaulO11 doutBUnkroAnPlNl1B1JJQ3.3-V LVTTL (deFault)12C ut9UnknownP1N.411Bl JIS3.3-V LVTTL (default)13 ctodtEioUnkroAnPIN-120303JI23.3-v lvttl (default)iqO cbuttlUnkroAnPJNJ323B3_N23.3-V LVTTL (default)15ut12UnknownP1N_1333B3JJ23.3-V LVTTL (default)160 Cbut13UnkroAnP

10、1N_13+3B5H23.3-V LVTTL (default)17cbut14UnkroAnPN_1353B3_H23.3-V LVTTL (default)18O ut15UnknownP1NJ3S3B3_N23.3-V LVTTL (default)19| cbjt16UnkroAnP1N_13?3B3JI23.3-V WTTL (default)20 dcut17UnkroAnPN_1 需3S3_N23.3-V LVTTL (default)21O ut10UnkroAnP1N_1393B3_N23.3-V LVTTL (default)22 dout 口刃UnkroAnP1N_KO3

11、D3JI23.3-V LVTTL (deFault)23C doutzoUnkroAnPN+ L303_N23.3-v lvttl (default)24dout2LUnkroAnP1N_15S3B-:_NQ3.3-V LVTTL (default)2E dout22UnkraMiP1NJ593D3JJ03.3-V IVTTL (deFault)260 d&JtZ3UnkroAnPN_160.3B3J1Q3.3-V LVTTL (default)27O SAUnkroAnP1N362B2JJ23.2-V IVTTL (default)28C SBUnknownP1N352BJN23.3-V L

12、VTTL (default)29C 3:UnkroAnP1N34ZBZJI23.3-v lvttl (default30 SDUnkroAnPN2332S2_N23.3-V LVTTL (default)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity ring isport(clk: in std_logic;clk500: in std_logic;clk1k:in std_logic;beep:out std_logic);end ring;architecture rtl of

13、 ring isbeginprocess(clk)variable t: std_logic;variable n: integer range 0 to 15:=0;beginif clk event and clk=1 then t:=not t;n:=n+1;end if;if t=1 and n11 thenbeep=clk500;elsif n=11 thenbeep=clk1k;else beepsys_en,clk=clk_h,clr=sys_rst,dout=reg_h);米:cnt_s port 米 ap(en=sys_en,clk=clk_ 米,clr=sys_rst,do

14、ut=reg_米,c=c_ 米);s:cnt_s port 米 ap(en=sys_en,clk=sys_clk1,clr=SCc,dout=reg_s,c=c_s);-sled:seg 米 ain port 米 ap(clk=clk1,reset_n=SCc,seg_data=seg_data,seg_co *=seg_co *,datain=dout(15 downto 0);-ring0:ringport米ap(en=en_r,clk=clk_ring,clk500=sys_clk500,clk1k=sys_clk1k,beep=beep);haoin1:haoin port 米 ap(

15、 SA,sys_clk64,SAc);haoin2:haoin port 米 ap( SB,sys_clk64,SBc);haoin3:haoin port 米 ap( SC,sys_clk64,SCc);haoin4:haoin port 米 ap( SD,sys_clk64,SDc);NL:naoling port 米 ap(beep=NL_ring,h=reg_h, 米 =reg_ 米 ,clk4hzh=sys_clk4_NL_h,clk4hz米 =sys_clk4_NL_米,sys_en=sys_en,sys_rst=sys_rst,h_o=NL_reg_h,米_o=NL_reg_ 米

16、);beep=clk_ring and 米 h;-led=reg_s(3 downto 0);p_sys_clk:process(clk1)variable t1,t4,t64,t500,t1k:integer range 0 to 50000000;beginif clk1 event and clk1=1 thent1:=t1+1;t4:=t4+1;t64:=t64+1;t500:=t500+1;t1k:=t1k+1;if t1二clki/2 thent1:=0;sys_clk1=not sys_clk1;end if;if t4二clki/8 thent4:=0;sys_clk4=not

17、 sys_clk4;end if;if t64二clki/128 thent64:=0;sys_clk64=not sys_clk64;end if;if t500二clki/1000 thent500:=0;sys_clk500=not sys_clk500;end if;if t1k二clki/2000 thent1k:=0;sys_clk1k=not sys_clk1k;end if;end if;end process p_sys_clk;p_c:process(SAc,SBc,SCc,SDc)beginif SAc=1 and SDc=0 then clk_h=sys_clk4;elseclk_h=c_*;end if;if SAc=1 and SDc=1 thensys_clk4_NL_h=sys_clk4;elsesys_clk4_NL_h二0;end if;if SBc=1 and SDc=0then clk_*=sys_clk4;elseclk_*=c_s;end if;if SBc=1 and SDc=1then

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论