【发布时间】:2013-02-24 15:02:55
【问题描述】:
我是 VHDL 新手。我收到了有关如何从 24 MHz 的输入时钟信号生成 1Hz(50% 占空比)的时钟信号的代码。我有一些问题需要进一步澄清。
- 如何选择计数器限制?在下面的情况下,12000000。什么 如果我想生成一个 8Hz 时钟信号,这个限制会是什么?
-
如果我想改变占空比应该如何调整代码 到 80%?
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity clock is port ( CLKin: in std_logic; reset: in std_logic; CLKout: out std_logic); end clock; architecture arch of clock is signal counter: integer:=0; signal temp : std_logic := '1'; begin process(CLKin,counter,reset) begin if(reset='0') then counter<=0; temp<='1'; elsif(CLKin'event and CLKin='1') then counter <=counter+1; if (counter = 12000000) then temp <= NOT temp; counter<=0; end if; end if; CLKout <= temp; end process; end arch;
【问题讨论】:
标签: counter vhdl clock frequency