0
我正在使用VHDL的红外解码器,我知道IR 1位的宽度为1.2毫秒,IR 0位为0.6毫秒,起始位为2.5毫秒。我正试图制作一个计数器,它能够接收50MHz时钟并转换为十分之一毫秒。我怎样才能做到这一点?你如何使vhdl计数器以十分之一毫秒计数?
entity counter is
Port (EN : in STD_LOGIC;
RESET : in STD_LOGIC;
CLK : in STD_LOGIC;
COUNT : out STD_LOGIC_VECTOR (4 downto 0));
end counter;
architecture Behavioral of counter is
constant max_count : integer := (2);
begin
startCounter: process(EN, RESET, CLK)
variable cnt : integer := 0;
variable div_cnt : integer := 0;
begin
if (RESET = '1') then
cnt := 0;
div_cnt := 0;
elsif (EN = '1' and rising_edge(CLK)) then
if (cnt = max_count) then
cnt := 0;
div_cnt:= div_cnt + 1;
else
cnt := cnt + 1;
end if;
end if;
COUNT <= conv_std_logic_vector(cnt, 5);
-- COUNT <= temp_count(16 downto 13);
end process startCounter;
end Behavioral;
请参阅相关链接:http://electronics.stackexchange.com/questions/144800/design-up-counter-in-vhdl-using-generate-statement – Barnstokkr 2015-03-13 08:29:39
我了解如何进行计数,但我需要帮助转换从系统时钟到十分之几毫秒。 – chanceofthat 2015-03-13 09:07:36
请参阅其他相关信息:http://stackoverflow.com/questions/19708301/making-a-clock-divider – Barnstokkr 2015-03-13 09:28:22