Home/Support/Support Forum/Measure length of Pulse
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Measure length of Pulse

+1 vote
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?
asked Sep 16, 2020 in Rabbit Software by Henrik New to the Community (6 points)

Please log in or register to answer this question.

1 Answer

0 votes
Best answer
Chapter 28 of the Rabbit 6000 Users Manual describes the Input Capture capabilities.


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.
answered Sep 18, 2020 by TomCollins Veteran of the Digi Community (2,082 points)
selected Sep 22, 2020 by TomCollins
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.