Main Site Documentation

Measuring a single pulse width


#1

I’m trying to use a timer to measure the width of a single pulse. I am able to do this with a long pulse without going into native code but my pulse is relatively short. So far, my method is to clear the capture register, start the timer, and read the capture register until it changes, subtracting the two values (rising edge capture and falling edge capture) will allow me to calculate the pulse width. I’m looking to measure about 10,000 cycles at 72MHz. I’m sure this method would work in native. Has anyone done this, or know of a way to do it?


#2

This should help http://wiki.tinyclr.com/index.php?title=PinCapture


#3

That’s awesome. Is the resolution of pincapture limited to 1 microsecond? I’m shooting for a resolution of about 250 nanoseconds (about 18 cycles at 72Mhz). Thanks for the quick reply.


#4

You will not get that in software. Check the processor datasheet for timers and capture feature.

I think the register access tutorial covers this partially.