Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Frequency divider for infrared output

Status
Not open for further replies.

devsan

Newbie level 1
Joined
Nov 4, 2009
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,288
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; clkout:eek:ut 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?
 

Look sharp, the divider factor is 27 rather than 26 in your code, but 26 would be better. Furthermore, you should provide a 50% duty cycle square wave.

Code:
begin 
if(clk'event and clk='1') then 
  if(cnt=12)then -- divide by 13
    cnt:=0; 
    clkout<=NOT clkout; -- divide by 2, generate square wave
  else 
    cnt := cnt+1; 
  end if; 
end if;
Usual RC receivers have about 10-15% relative bandwidth, 38.5 kHz would cause no relevant sensitivity drop.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top