devsan
Newbie level 1
Hi I need to divide my frequency from 1MHz to 38kHz, will this code help me do that?
entity test is
port( clk:in bit; clkoutut bit);
end test;
architecture behavior of test is
begin
process(clk)
variable cnt : integer range 0 to 26;
begin
if(clk'event and clk='1') then
if(cnt=26)then
cnt:=0;
clkout<='1';
else
cnt := cnt+1;
clkout<='0';
end if;
end if;
end process;
end behavior;
This should give me a frequency of 38,5kHz will this work for an IR transmitter?
entity test is
port( clk:in bit; clkoutut bit);
end test;
architecture behavior of test is
begin
process(clk)
variable cnt : integer range 0 to 26;
begin
if(clk'event and clk='1') then
if(cnt=26)then
cnt:=0;
clkout<='1';
else
cnt := cnt+1;
clkout<='0';
end if;
end if;
end process;
end behavior;
This should give me a frequency of 38,5kHz will this work for an IR transmitter?