electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

Frequency divider for infrared output


Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> Frequency divider for infrared output
Author Message
devsan



Joined: 04 Nov 2009
Posts: 1


Post04 Nov 2009 20:16   

Frequency divider for infrared output


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:out 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?
Back to top
Google
AdSense
Google Adsense




Post04 Nov 2009 20:16   

Ads




Back to top
FvM



Joined: 22 Jan 2008
Posts: 5161
Helped: 767
Location: Bochum, Germany


Post04 Nov 2009 21:07   

Re: Frequency divider for infrared output


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.
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> Frequency divider for infrared output
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Frequency Divider - a circuit with specified output (3)
help for frequency divider (11)
Is retiming circuit indispensable for frequency divider? (1)
Analog frequency divider for a crystal oscillator (4)
Low input frequency for TSPC-based Divider (1)
need VHDL code for RAMP generator and frequency divider (3)
IR(infrared) to RF(radio frequency) (3)
resistor divider output (17)
Input Output Admittance/Frequency for BJTs (3)
Frequency divider IC (2)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS