数字时钟显示实验报告

上传人:正** 文档编号:41712111 上传时间:2018-05-30 格式:DOC 页数:24 大小:227.08KB
返回 下载 相关 举报
数字时钟显示实验报告_第1页
第1页 / 共24页
数字时钟显示实验报告_第2页
第2页 / 共24页
数字时钟显示实验报告_第3页
第3页 / 共24页
数字时钟显示实验报告_第4页
第4页 / 共24页
数字时钟显示实验报告_第5页
第5页 / 共24页
点击查看更多>>
资源描述

《数字时钟显示实验报告》由会员分享,可在线阅读,更多相关《数字时钟显示实验报告(24页珍藏版)》请在金锄头文库上搜索。

1、实验名称:数字时钟设计实验名称:数字时钟设计实验仪器及软件:实验仪器及软件:计算机,QUARTAS。实验目的:实验目的: 1 全面了解如何应用该硬件描述语言进行高速集成电路设计; 2.通过对数字时钟软件设计环节与仿真环节熟悉 Quartus II 设计与仿真环境; 3. 通过对数字时钟的设计,掌握硬件系统设计方法(自底向上或自顶向下) , 熟悉 VHDL 语言三种设计风格,熟悉其芯片硬件实现的过程。 4 体会硬件设计语言在工程中的重要性。全面掌握设计方法和过程。实验要求:设计一个数字时钟,并输出到数码管显示时,分,秒。实验原理实验原理: A 整体系统实行自顶下的原则,通过顶层实体分别串接各个设

2、计部件,各个 部件接口通过端口映射的方式进行串接,从而达到设计目的。 B 整个程序中涉及的部件有:(1)分频器,对输入时钟 40Mhz 进行 40000000 分频,得到 1Hz 信号,作为计数器的计数时钟;对输入时钟 40Mhz 进行 400000 分频,得到 100Hz 信号,作为数码显示管位扫描信号(2)计数器, 用 24 进制计数器作为小时位的计数,用 60 进制计数器作为分位,秒位的计数。 (3)位选程序,实现六个数码显示管动态扫描显示, (4)LED 显示程序:用 于显示信号在数码管。 (5)顶层模块实体部分,指明了输入输出端口,各部分 的联系和链接,以及通过端口映射连接各部分,实

3、现整个程序功能。 C 关于动态显示,扫描频率设置为 100HZ,这个频率大于要求的 50HZ,利用 人眼的视觉暂留效果,则看不到闪烁现象,可以实现动态显示功能。 D 在计数器的时钟选择上,选择的是 1HZ 频率,满足了每秒一次的要求。 设计思路及 VHDL 代码 E 两个模 60 的计数器来代表时钟的秒针,分针,再用一个模 23 的计数器来代 替时针。外部基础时钟信号作为秒针计数器的时钟信号,秒针计数器的近进位 信号作为分针计数器的时钟信号,分针计数器的进位信号有作为时针计数器的 时钟信号,最后在统一输出。需要注意的是到 23 时 59 分 59 秒后下次跳动清零, 从头开始。基础时钟信号选择

4、 1HZ 最为简单。我们做了以 40MHZ 为基础时钟信 号的时钟,主要要点在将 40MHZ 分频到 1HZ。下面通过原理结构图描述系统下面通过原理结构图描述系统M=3 计数 器数码管译码 器时钟信号进位信号M=10 计数 器数码管译码 器时钟信号进位信号M=6 计数 器数码管译码 器进位信号时钟信号M=10 计数 器数码管译码 器M=10 计数 器数码管译码 器秒针个位显示信号秒针 计 数 器M=6 计数 器数码管译码 器时钟信号进位信号秒针十位显示信号时钟信号进位信号分针个位显示信号分针十位显示信号时针个位显示信号时针十位显示信号分 针 计 数 器时 针 计 数 器S110=S110+1S

5、110=”0101”?时钟信号时钟上升沿?S220=”1001”?S220=S220+1S220=”0000”S110=”0000”输出上升沿脉冲外部基础时钟信号YNYNYm110=m110+1m110=”0101”?时钟信号时钟上升沿?m220=”1001”?m220=m220+1m220=”0000”m110=”0000”输出上升沿脉冲YNYNY秒针计数器提供h110=h110+1h110=”0101”?时钟信号时钟上升沿?h220=”1001”?h220=h220+1h220=”0000”h110=”0000”输出上升沿脉冲分针计数器提供YNYNY一,顶层实体模块源代码一,顶层实体模块源

6、代码 数字钟的顶层模块程序 clock.vhd library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all;entity clock is port(clk :in std_logic;set :in std_logic;qin_s_1 : in std_logic_vector(3 downto 0); -秒钟的低位调整输入端qin_s_2 : in std_logic_vector(3 downto 0); -秒钟的高位调整输入端qin_m_

7、1 : in std_logic_vector(3 downto 0); -分钟的低位调整输入端qin_m_2 : in std_logic_vector(3 downto 0); -分钟的高位调整输入端qin_h_1 : in std_logic_vector(3 downto 0); -时钟的低位调整输入端qin_h_2 : in std_logic_vector(3 downto 0); -时钟的高位调整输入端qout : out std_logic_vector(6 downto 0); -7 段码输出sel : out std_logic_vector(5 downto 0) -位选

8、输出端); end clock;architecture behave of clock is component cnt24 isport(clk : in std_logic;set : in std_logic;din1 : in std_logic_vector(3 downto 0);din2 : in std_logic_vector(3 downto 0);qout1 : out std_logic_vector(3 downto 0);qout2 : out std_logic_vector(3 downto 0); end component cnt24;component

9、cnt60 isport(clk : in std_logic;set : in std_logic;din1 : in std_logic_vector(3 downto 0);din2 : in std_logic_vector(3 downto 0);qout1 : out std_logic_vector(3 downto 0);qout2 : out std_logic_vector(3 downto 0);carry : out std_logic); end component cnt60;component fen1 is port(clk:in std_logic;qout:

10、out std_logic); end component fen1;component fen100 is port(clk:in std_logic;qout:out std_logic); end component fen100;component weixuan is port(clk : in std_logic;qin1 : in std_logic_vector(3 downto 0);qin2 : in std_logic_vector(3 downto 0);qin3 : in std_logic_vector(3 downto 0);qin4 : in std_logic

11、_vector(3 downto 0);qin5 : in std_logic_vector(3 downto 0);qin6 : in std_logic_vector(3 downto 0);qout : out std_logic_vector(3 downto 0);sel : out std_logic_vector(5 downto 0); end component weixuan;component led_driv is port(qin : in std_logic_vector(3 downto 0);qout : out std_logic_vector(6 downt

12、o 0); end component led_driv;signal carry1: std_logic; signal carry2: std_logic; signal qout1 : std_logic; signal qout100 : std_logic; signal qout_s_1:std_logic_vector(3 downto 0); signal qout_s_2:std_logic_vector(3 downto 0); signal qout_m_1:std_logic_vector(3 downto 0); signal qout_m_2:std_logic_v

13、ector(3 downto 0); signal qout_h_1:std_logic_vector(3 downto 0); signal qout_h_2:std_logic_vector(3 downto 0); signal qoutI:std_logic_vector(3 downto 0);begin U0:fen1 port map(clk=clk,qout=qout1);U1:fen100 port map(clk=clk,qout=qout100); U2:cnt60 port map(clk=qout1,set=set,din1=qin_s_1,din2=qin_s_2,

14、qout1=qout_s_1,qout2=q out_s_2,carry=carry1); U3:cnt60 port map(clk=carry1,set=set,din1=qin_m_1,din2=qin_m_2,qout1=qout_m_1,qout2 =qout_m_2,carry=carry2); U4:cnt24 port map(clk=carry2,set=set,din1=qin_h_1,din2=qin_h_2,qout1=qout_h_1,qout2= qout_h_2); U5:weixuan port map(clk=qout100,qin1=qout_s_1,qin

15、2=qout_s_2,qin3=qout_m_1,qin4=qout_ m_2,qin5=qout_h_1,qin6=qout_h_2,qout=qoutI,sel=sel); U6:led_driv port map(qin=qoutI,qout=qout);end behave;这部分实现的是顶层实体,它是程序的核心,通过端口映射把其他各部件程序 端口连接为一个整体,指明系统的输入端口,输出端口,输入型号,输出信号。二,分频部分二,分频部分 1,功 能:对输入时钟 40Mhz 进行 40000000 分频,得到 1Hz 信号 接 口:clk -时钟输入qout-秒输出信号library i

16、eee; use ieee.std_logic_1164.all;entity fen1 is port(clk:in std_logic;qout:out std_logic); end fen1;architecture behave of fen1 is constant counter_len:integer:=10#39999999#; signal cnt:integer range 0 to counter_len; beginprocess(clk)beginif clkevent and clk=1 thencase cnt iswhen 0 to counter_len/2=qoutqoutqoutqoutqoutqoutqoutqoutqoutqou

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 其它办公文档

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