Frequency reducer


Closed Thread
Results 1 to 6 of 6
  1. #1

    Default Frequency reducer

    I have a 12F683 pic recieving a stream of pulses from a device.

    The mark space ratio is always 50% but the speed of the pulses varies from say 1hz upto 150hz.

    Now what i want to do is time/measure the incoming pulses duration somehow and output on a different pin new pulses with the frequency reduced by say 30%

    I thought about pulsin/pulsout but that won't work as you miss the start of the next pulse if you increase the length of the pulse you are sending out using that IIRC.

    Any bright ideas? Or anyone done anything similiar before? Thanks

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Frequency reducer

    Looks like i need some sort of background interrupt on pin change driven service measuring the length of the incomming pulses and updating a variable with the pulse length.

    The main program needs to look at this variable and then caluclate the length of the pulse it needs to sends out.

    Once that pulse has been sent it then looks again at the length variable and adjusts itself accordingly as the incomming pulse freq changes.

    A divide by 2 logic device might do the trick if i opt for a 50% reduction in frequency vbut how to do that with a pic?
    Last edited by retepsnikrep; - 14th February 2013 at 14:57.

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Frequency reducer

    A divide by 2 logic device might do the trick if i opt for a 50% reduction in frequency vbut how to do that with a pic?
    50% isn't hard (though a hardware flip/flop is even easier). Just wire the input signal to INT0 for example, set it up to interrupt on the rising (or falling) edge, toggle the output signal each interrupt. If you need anything but 50% you really need to measure the frequency/pulsewidth, calculate the new frequency/period and either adjust the period of a timer interrupt or use the CCP module to generate the desired output frequency.

    /Henrik.

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: Frequency reducer

    Henrik

    Thanks i did try 50% and that works fine but I really need a divide by 1.5 rather than divide by 2, so will have to think further along the lines you suggest.

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: Frequency reducer

    Divide by 1.5 is to multiply per 2 and divide by 3 ...

    Easily done vith "old" logic TTL or 4000 ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: Frequency reducer

    Well I have DT Instant interrupts plumbed in with a flag now changing to indicate change of the pulse input pin (low to high) So i can measure the length of the full pulse length, but I'm a bit stuck now on how to use a timer to do that and have a timer running in the background keeping track of the extended output pulse. :?

Similar Threads

  1. PWM to Frequency
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th October 2011, 02:59
  2. Low frequency PWM
    By Charlie in forum General
    Replies: 3
    Last Post: - 16th February 2011, 14:31
  3. I2C clock frequency?
    By Qacer in forum Serial
    Replies: 8
    Last Post: - 27th January 2006, 14:40
  4. Which is the frequency?
    By fabritio in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd November 2005, 21:17
  5. Frequency
    By MICOCALI in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 11th August 2004, 02:40

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts