Menu

Pulse timing measurement

Help
2009-08-11
2013-05-30
  • Nobody/Anonymous

    What is the best way to measure the time between 2 pulses, one each on an input?  The pulse pair repetition rate is about 80Hz., with the time between pulses from near 0ms to near 12.5ms.  The output would be a 20 - 30 Hz PWM proportional to the time between input pulses.  For best response, the input measurement and output PWM must run concurrently.  What micro would be most suitable for this task?

     
    • kent_twt4

      kent_twt4 - 2009-08-12

      If the output is real time, then wouldn't the frequencies of the input and output need to be the same?  If they were the same frequency, one could use two comparators and set and clear the output bit accordingly.

      The 18fxx31 devices has the most advanced PWM module of all eight bit PICS.  The PWM period can go down to 19-38 Hz at a 40 Mhz clock.  Could be useful?

      With the same device, and pure speculation.  Use the high speed analog converter and simultaneous two channel sampling to keep track of the input states.  Start a clock when first condition met, and end it on second.  Send the difference as the duty cycle to the power PWM module above.  There is some lag there, but seems unavoidable.

       
    • Nobody/Anonymous

      There is a minimum delay, which is at least one input interval to obtain data.
      With only 3 I/O needed for this task, the 18Fxx31 series looks like an overkill.  It appears there are multipule ways to do this task with a xx31.
      One way or the other there are 2 tasks that need to run on independently, obtain delta time at one rate, and output a PWM at another rate, without interfering with each other.
      Is there a smaller lower cost micro that will work?

       
    • kent_twt4

      kent_twt4 - 2009-08-12

      Sure, cheaper smaller devices abound, if you would be willing to up the frequency of the output.  Two analog channels, comparators, or interrupts would probably do for the inputs.  One hardware PWM for the output, if the output frequency could be reconciled.

      Development on an overdone chip shouldn't be a crime if most/all avenues, or scenarios could be explored.  A 18f1230 has three analog comparators or PWM's, if that's what it takes?  Works for an rgb led anyway at the very least.

      Like to hear other ideas on this too.

       
    • Nobody/Anonymous

      The input and output frequencies are set.  30 Hz. is the max output frequency, with less desirable.
      Software could calculate an output high and low times instead of PWM,, would this be an issue?
      The input pulses are about 1 ms wide and can have very little if any time between the leading edges, something interrupts might not handle well if they miss an edge.  How would A/D inputs measure the time between pulses?
      This looks more like a timing task, one timer for the input and 1 or 2 for the output.  Does that sound doable?, in a smaller micro?
      Any other ideas, comments, or suggestions appreciated.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.