Measure length of Pulse

RCM6700 - I have a signal connected on the PE1 interrupt, need to measure the length of a pulse on this pin. Ie timestamp each transition on the signal HIGH-LOW and LOW-HIGH. Length of time measured is expected to be 500-8000ns. I need better than the MS_TIMER resolution. suggestions?

1 Like

Chapter 28 of the Rabbit 6000 Users Manual describes the Input Capture capabilities.

https://www.digi.com/resources/documentation/digidocs/pdfs/90001108.pdf

Unfortunately, there isn’t a lot of sample code for using the Input Capture feature of the chips. You might be able to use Samples/Rabbit4000/ic_test.c as a starting point.

You’ll need to configure TAT12R, TAT8R and TAECR to make your timings off of the raw peripheral clock. And GCSR for the peripheral clock to use the main oscillator (which I believe is only 25MHz).

I’m not sure of the details, but with 25MHz=40ns, there’s some wiggle room there. I’d make use of that sample, trying to configure a low divisor. Then send in a known pulse length and see what your reading is (the count should * 40ns should be close, or a power-of-2 fraction of the actual length).

You’ll need to write an ISR to store the counter value somewhere that your main program can retrieve and process it later. Hopefully you’re measuring a short pulse with long quiet times so you’re only seeing thousands of pulses a second and not millions.

Thanks, Tom, I will try this - looks like it should do the trick. The number of pulses is sub 100 so I will just queue the timestamps for subsequent processing in my main.