基于vhdl的数字电子钟的设计内容摘要:

end if。 elsif(count1660)then count=count+1。 enhour_1=39。 039。 after 100 ns。 else count=0000000。 end if。 end if。 end process。 end fun。 模块:用来对时进行计数,当记到计数器的低四位为 1001 时,若高三位小于 010 时,则时计数器加 7,目的是使计数值变为 BCD 码。 当计数器的高三位小于 010,低四位小于 1001 时,计数器加 1;若当计数器记到 0100100 时,则有一进位。 HOUR 模块的时钟由 SETHOUR 和 MINUTE 记到 60 的进位两部分组成。 HOUR 模块源程序如下: library ieee。 use。 use。 entity hour is port(clk,reset:in std_logic。 daout:out std_logic_vector(5 downto 0) )。 end entity hour。 architecture fun of hour is signal count:std_logic_vector(5 downto 0)。 begin daout=count。 process(clk,reset) begin if(reset=39。 139。 )then count=000000。 elsif(clk39。 event and clk=39。 139。 )then if(count(3 downto 0)=1001)then if(count1623)then count=count+7。 else count=000000。 end if。 elsif(count1623)then count=count+1。 else count=000000。 end if。 end if。 end process。 end fun。 CLOCK_TOP 模块:用来对元件进行例化,以及对 端口进行映射。 HOUR 模块源程序如下: library ieee。 use。 entity clock_top is port(clk,reset,setmin,sethour:in std_logic。 second_daout,minute_daout:out std_logic_vector(6 downto 0)。 hour_daout:out std_logic_vector(5 downto 0) )。 end clock_top。 architecture a of clock_top is ponent second port(clk,reset,setmin:in std_logic。 daout:out std_logic_vector(6 downto 0)。 enmin:out std_logic)。 end ponent。 ponent minute port(clk,reset,clk1,sethour:in std_logic。 enhour:out std_logic。 daout:out std_logic_vector(6 downto 0))。 end ponent。 ponent hour port(clk,reset:in std_logic。 daout:out std_logic_vector(5 downto 0))。 end ponent。 signal enmin_re,enhour_re:std_logic。 begin u1:second port map(reset=reset, clk=clk, setmin=setmin, enmin=enmin_re, daout=second_daout)。 u2:minute port map(clk=enmin_re, reset=reset, clk1=clk, sethour=sethour, enhour=enhour_re, daout=minute_daout)。 u3:hour port map(clk=enhour_re, reset=reset, daout=hour_daout)。 end a。 (二) 硬件 设计 : 利用 QuartusII 把程序写入实验板,根据上面的输入输出引脚,锁定到芯片引脚。 本实验运用的芯片是 EPF10K10LC844,还有利用了 6个 LED显示,分别显示时、分、秒各两个,没有利用译码器,利用的 LED 是 8 引脚的。 本次验证利用实验板的模式 7,根据板的说明书,锁定引脚并下载程序。 引脚锁定: clk——pin_93,sethour—— pin_7, Setmin—— pin_4,。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。