signal clk,co_temp : std_logic; begin
clk<=clock when load='0' else putust;
process (clk,clr) begin if (clr='1') then
s1_temp <= \;
s10_temp <= \;
elsif (clk'event and clk='1')then
if (s1_temp=9) then s1_temp <= \;
if (s10_temp=5) then
s10_temp <= \
co_temp<='1';
else
co_temp<='0'
;
s10_temp <= s10_temp+1; end if; else
co_temp<='0'
;
s1_temp <= s1_temp+1; end if;
--进位判断 end if; end process;
s1 <= s1_temp when (clk_1s='1'or load='0') else \;
s10 <= s10_temp when (clk_1s='1' or load='0') else \;
co <= co_temp when (load='0') else '0' ;
end func;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL;
--24进制计数器
entity counter_24 is
port(clock : in std_logic; --计数信号 clk_1s : in std_logic; --周期1s 的时钟信号 putust : in std_logic;
clr : in std_logic; --清零信号
load : in std_logic; --判定信号
s1 : out std_logic_vector(3 downto 0);--计数器的个位 s10 : out std_logic_vector(6 downto 0));--计数器的十位 end counter_24;
architecture func of counter_24 is
signal s1_temp : std_logic_vector(3 downto 0); signal s10_temp : std_logic_vector(1 downto 0); signal clk : std_logic; begin
clk<=clock when load='0' else
putust;
process (clk,clr) begin
if (clr='1') then s1_temp <= \;
s10_temp <= \;
elsif (clk'event and clk='1') then
if (s1_temp=3 and s10_temp=2) then s1_temp <= \;
s10_temp <= \;
elsif (s1_temp=9) then s1_temp<=\;
s10_temp<=s10_temp+1;
else
s1_temp <= s1_temp+1; end if; end if; end process;
--显示进程 process(s10_temp) begin
if (clk_1s='1' or load='0') then
case s10_temp is
when \
when \ when \ when others => null; end case; else
s10<=\ end if;
end process;
s1 <= s1_temp when (clk_1s='1' or load='0') else \ end func;
四、 实验小结:
注意当时钟处于被修改状态时,即对时、分、秒的值进行修改时,不应产生进位,产生很多莫名其妙的错误,如修改后有进位(分钟为00)时,或者自行到整点响铃后,再次给脉冲会进位的情况。最终修改了很多语句,实际就是在修改给脉冲时强制使进位信号为0. 注意计数器60,,2进制的实现,加入响铃后需要把进位信号放到计数过程中才能使响铃正常。 调整非秒针时,秒针依旧走动,通过1s计数器实现闪烁,符合实际情况。 此次试验模块多且杂,需要更加细化的了解程序实质,也对代码的执行方式和顺序有了更加深刻的认识
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库北邮数字逻辑课程设计实验报告(电子钟显示)(2)在线全文阅读。
相关推荐: