Measure PWM
Travis M. Best
Posts: 9
Is their a easy to input a 5v signal and measure the pulse width using a propeller????
Thanks
Travis
Thanks
Travis
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
Put a series resistor (3K3 to 4K7) between the prop pin and the signal source.
Use waitpeq or waitpne to wait for a signal transition on the pin and store the value of cnt in a register.
Use waitpeq or waitpne to wait for another signal transition and store the value of cnt in another register.
Subtract the first cnt value from the second to get the number of clock cycles between the two transitions.
Multiply by the period of the clock to get the pulse width.
John Abshier
[noparse][[/noparse]Edit] I've attached an update that measures a high- or low-going pulses. The init() method includes a mode parameter (0 for low, 1 for high).
Post Edited (JonnyMac) : 1/4/2010 7:52:26 PM GMT
John Abshier