我用quartusⅡ已编译并且仿真都对的,我写的是0亮1灭,如果实际情况与这相反,你自己倒一下。
LIBRARY IEEE;
USE IEEESTD_LOGIC_1164ALL;
USE IEEESTD_LOGIC_SIGNEDALL;
USE IEEEnumeric_stdall;
ENTITY test IS
PORT (clock: in std_logic; -----clock1加48MHz的信号
row: out std_logic_vector(0 to 7));
END test;
ARCHITECTURE behave OF test IS
CONSTANT fp_clka:INTEGER:=12000000; ---扫描信号频率为2Hz
SIGNAL a: INTEGER RANGE 0 TO 12000001;
signal saomiao :integer range 0 to 9;
SIGNAL clka: std_logic;
BEGIN
PROCESS (clock)
BEGIN
IF rising_edge(clock) THEN
IF a<fp_clka then --clka
a<=a+1;
clka<=clka;
ELSE
a<=0;
clka<= NOT clka;
end if;
end if;
end process;
process(clka)
BEGIN
IF rising_edge(clka) THEN
saomiao<=saomiao+1;
if saomiao=9 then
saomiao<=0;
end if;
case saomiao is ---'1'代表不亮,'0'代表亮
when 0 =>row<="01111111";
when 1 =>row<="10111111";
when 2 =>row<="11011111";
when 3 =>row<="11101111";
when 4 =>row<="11110111";
when 5 =>row<="11111011";
when 6 =>row<="11111101";
when 7 =>row<="11111110";
when 8 =>row<="00000000";
when others =>row<="11111111";
END CASE;
END IF;
end process;
END behave;
42是16进制数字,换算成10进制就是66,。输入时钟是66M,用计数器计数,计到66,CLK_1M翻转一次,然后计数器清零,再过66个时钟周期再翻转一次,循环得到的CLK_1M就是1MHz,。
以上就是关于急急急急急急!!!!!有会用VHDL语言实现数字钟的...帮忙!!!!!!!!全部的内容,包括:急急急急急急!!!!!有会用VHDL语言实现数字钟的...帮忙!!!!!!!!、用VHDL设计电子时钟、用VHDL语言编写程序等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)