EDA电子钟多功能数字时钟课程设计(含代码)

上传人:大米 文档编号:484942716 上传时间:2023-03-01 格式:DOC 页数:11 大小:163.02KB
返回 下载 相关 举报
EDA电子钟多功能数字时钟课程设计(含代码)_第1页
第1页 / 共11页
EDA电子钟多功能数字时钟课程设计(含代码)_第2页
第2页 / 共11页
EDA电子钟多功能数字时钟课程设计(含代码)_第3页
第3页 / 共11页
EDA电子钟多功能数字时钟课程设计(含代码)_第4页
第4页 / 共11页
EDA电子钟多功能数字时钟课程设计(含代码)_第5页
第5页 / 共11页
点击查看更多>>
资源描述

《EDA电子钟多功能数字时钟课程设计(含代码)》由会员分享,可在线阅读,更多相关《EDA电子钟多功能数字时钟课程设计(含代码)(11页珍藏版)》请在金锄头文库上搜索。

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

2、间设置,也就是手动调时功能:当认为时钟不准确时,可以分别对分时钟进行调整;5. 闹钟:实现分/时闹钟设置,在时钟到达设定时间时通过扬声器响铃。有静音模式。 待改进功能:1. 系统没有万年历功能,正在思考设计方法。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 is port(en,clk,clr:in st

3、d_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);begin process(en,clk,clr) variable t:std_logic_vector(7 downto 0); begin if en=1 then -异步使能 if clk event and clk=1 then t:=t+1; if t(3 downto 0)=XA then -个位等于1

4、0则十位加1 t(7 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;时计数器模块仿真波形如下从仿真波形可知,当计数到23时,下一个时钟上升沿到来时就清零了,符合设计要求。时计数模块框图如下2. 分及秒计数模块分及秒计数模块也是一个2位10进制计数器,记数到59清零。VHDL的RTL描述如下

5、:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt_s is port(en,clk,clr:in std_logic; dout:buffer std_logic_vector(7 downto 0); c:out std_logic);end cnt_s;architecture rtl of cnt_s isbegin process(en,clk,clr) begin if en=1 then if clr=1 then -异步清零 dout=X00; elsif cl

6、k 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 then dout(3 downto 0)=X0; dout(7 downto 4)=dout(7 downto 4)+1; else dout=X00; c=1; end 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;

7、 end process;end rtl;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity ring is port( clk: in std_logic; clk500: in std_logic; clk1k:in std_logic; beep:out std_logic);end ring;architecture rtl of ring isbegin process(clk) variable t: std_logic; variable n: integer range

8、0 to 15:=0; begin if clk event and clk=1 then t:=not t;n:=n+1; end if; if t=1 and n11 then beep=clk500; elsif n=11 then beep=clk1k; else beep=Z; end if; end process;end rtl;library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all;use IEEE.std_logic_unsigned.all; entity clock is port(

9、SA: in std_logic; SB: in std_logic; SC: in std_logic; SD: in std_logic; clk1: in std_logic; dout: buffer std_logic_vector(23 downto 0); -seg_data:out std_logic_vector(7 downto 0); -seg_com:out std_logic_vector(3 downto 0); beep: out std_logic -led:out std_logic_vector(3 downto 0) );end entity clock;

10、architecture rtl of clock is component cnt_s is port(en,clk,clr:in std_logic; dout:buffer std_logic_vector(7 downto 0); c:out std_logic); end component; component cnt_h is port(en,clk,clr:in std_logic; dout:buffer std_logic_vector(7 downto 0) ); end component; -component segmain is -port(clk,reset_n

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 国内外标准规范

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号