电子钟设计功能实现: 此电子钟实现了正常跑表时钟,闹钟,秒表,调节 LED 灯亮度的功能。此电子钟使用键 1 来控制模式选择。正常跑表时钟为默认模式。当按下键 1时, 接收到的高脉冲后模式跳转为闹钟时间模式,当再次按下键 1 时转到秒表模式。在正常跑表时钟模式中, 通过键 5 来控制时间调节, 当按下键 5 后用键 7 来调节时进位, 用键 4 来调节分进位。而在闹钟模式下, 同样采用键 5 来控制调节闹铃时间, 其中键 7 用来调节时进位,键 4 用来调节分进位。当正常跑表时钟的时间与闹钟模式下设置的时间相同时,蜂鸣器就会发出声响。在秒表模式下,键4 为控制键, 按下键 4 后秒表开始计时。在计时过程中,键8 为暂停键,键 5 为清零键。最后刷新 LED 功能,键 8 为控制键,按下键 8 后,通过键 7 来调节亮度。代码: 顶层文件 library ieee; use ; use ; entity electronic_clock is port( clk : in std_logic; k_minute,k_hour,k,k_8,input:in std_logic; --- -k_minute 为键 4, k_hour 为键 7,k 为键 5, k_8 为键 8, input 为键 1 voice:out std_logic; sg11:out std_logic_vector(6 downto 0); bt11:out std_logic_vector(7 downto 0)); end electronic_clock; architecture one of electronic_clock ponent clock ---- 正常跑表时间模式 port(clk,k_minute,k_hour,k:in std_logic; hour1,hour2,minute1,minute2,second1,second2:out std_logic_vector(3 downto 0)); ponent; component alarm --- 闹钟模式 port(clk,k,k_minute,k_hour:in std_logic; hour_1,hour_2,minute_1,minute_2,second_1,second_2:out std_logic_vector(3 downto 0)); ponent; component pao --- 秒表模式 port(clk:in std_logic; clk1: in std_logic; clk2:in std_logic; clk3:in std_logic; pao1,pao2,second_p1,second_p2:out std_logic_vector(3 downto 0)); ponent; component sound ----- 闹钟中的蜂鸣器 port(clk:in std_logic; s_in1:in std_logic_vector(3 downto 0); s_in2:in std_logic_vector(3 downto 0); s_in3:in std_logic_vector(3 downto 0); s_in4:in std_logic_vector(3 downto 0); s_in11:in std_logic_vector(3 downto 0); s_in12:in std_logic_vector(3 downto 0); s_in13:in std_logic_vector(3 downto 0); s_in14:in std_logic_vector(3 downto 0); s_out:out std_logic); ponent; component mux31a --- 控制选择输出 port( k_in:in std_logic; k_out:out std_logic_vector(1 downto 0); q1_out,q2_out:out std_logic); ponent; component fenpin --- 分频 port( clk_10000000:in STD_LOGIC; clk_100,clk_1,clk_10000:out STD_LOGIC); ponent; component xuanze --- 选择输出 port( q:in std_logic_vector(1 downto 0); second1:in std_logic_vector(3 downto 0); s
LED显示的电子钟设计 来自淘豆网m.daumloan.com转载请标明出处.