Joined: 30 Jul 2007 Posts: 112 Location: Moscow, Russia
How to measure a duty cycle (on-off ratio) of a unknown freq
Posted: Fri Sep 19, 2008 9:35 am
How to measure a duty cycle (on-off ratio) of a unknown frequency? (Frequency is lower than 10 kHz). I know how to do this with 18Fxx31 series (with hardware period and pulse width measurement), but how to do this with common pic with CCP?
RLScott
Joined: 10 Jul 2007 Posts: 465
Re: How to measure a duty cycle (on-off ratio) of a unknown
Posted: Fri Sep 19, 2008 11:06 am
Use Input Capture mode. Configure for rising edge capture. As soon as you get a capture event, store the captured timer value (PR register) and re-configure for falling edge capture, etc. Subtracting consecutive captured times will give you the periods (on-time and off-time). _________________ Robert Scott
Real-Time Specialties
Embedded Systems Consulting
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum