1、 电电 子子 信信 息息 科科 学学 与与 技技 术术 EDA 课程设计报告课程设计报告 设计题目: 数字时钟的设计 班 级 : 电子 1201 一、一、 实验目的实验目的 学习并掌握数字钟的原理、设计方法。 二、二、 实验内容实验内容 计数始终由模 60 秒计数器、模 60 分计数器、模 24 小时计数器、报时模块、分,时校定模块及输出 显示组成,可以采用同步计数器或异步计数器设计方法。 三、三、 实验实验要求要求 1、 计时范围为 0 小时 0 分 0 秒至 23 小时 59 分 59 秒。 2、 采用 6 个 8 段数码管分别显示小时十位,小时个位,分钟十位,分钟个位,秒十位,秒个位。
2、3、 整点报时,蜂鸣器响 5 声,每秒响一声。 4、校时功能能够单独校分,校时,校秒,用按键控制。 5、具有清零,启动,停止计数功能,用按键控制。 6、采用静态扫描方式显示。 四、四、 系统设计方案系统设计方案 1、 整个模块采用一个时钟,时钟的频率为一秒,用于程序秒的输入。 2、 时分秒皆采用两个位的计数,一位代表十位,一位代表个位。分秒为 60 进制,时为 24 进制。个 位逢九向十位进一,秒逢 59 向分进一,分逢 59 向时进一。 3、 在小时的子程序里把两位小时数转换成一位数作为报时程序的输入。 五、五、 主要主要 VHDL 源程序源程序 主程序:主要将主程序:主要将建好的建好的模模
3、 6060 秒计数器、模秒计数器、模 6060 分计数器、模分计数器、模 2424 小时计数器、报时模块、分,时校定模小时计数器、报时模块、分,时校定模 块,译码模块连接起来。用的是端口映射方式。块,译码模块连接起来。用的是端口映射方式。 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; entity time1 is -generic(N: integer :=60 ); port( clk:in std_logic; reset:
4、in std_logic; stop:in std_logic; clock_out:out std_logic; min_add:in std_logic; hour_add:in std_logic; secout_1:out std_logic_vector(6 downto 0); secout_2:out std_logic_vector(6 downto 0); min_out_1:out std_logic_vector(6 downto 0); min_out_2:out std_logic_vector(6 downto 0); hour_cout_1:out std_log
5、ic_vector(6 downto 0); hour_cout_2:out std_logic_vector(6 downto 0) ); end entity time1; architecture xtime1 of time1 is -60s component secoud is port( clk:in std_logic; reset:in std_logic; secout1:out integer range 0 to 9; secout2:out integer range 0 to 9; -0 to 5 en_min:out std_logic ); end compon
6、ent secoud; -60min component minute is port( en_min:in std_logic; reset:in std_logic; min_out1:out integer range 0 to 9; min_out2:out integer range 0 to 9; -0 to 5 en_hour:out std_logic ); end component minute; -24hour component hour is port( en_hour:in std_logic; reset:in std_logic; hour_cout1:out integer range 0 to 9; hour_cout2:out integer range 0 to 9 -0 to 2 ); end component hour; -yima component decode_dis is port( din:in integer range 0 to 9; d