How to read pulse width modulation (PWM) signal that is fed to a pic?
Should I make a timer which starts with a rising signal and stops with falling signal?
Or should I try to transfer the PWM to analog signal (voltage), which I would be able to read?
Any advise?
thanks already in advance..
reading PWM with pic
Moderators: David Barker, Jerry Messina
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
It would be a lot more accurate to measure the width directly, but that might depend on the freq/width you're working with.
Perhaps check out the CCP module Tips and Tricks for some ideas http://ww1.microchip.com/downloads/en/D ... 41214a.pdf
Perhaps check out the CCP module Tips and Tricks for some ideas http://ww1.microchip.com/downloads/en/D ... 41214a.pdf
The CCP module tip is just what I needed. Thanks.
I'm trying to figure out how to write the code to use the capture mode in CCP.
I looked the datasheet of my pic (PIC18f2420), and I also looked the "Using PWM with Swordfish" from the SwordfishWiki pages, but I have to admit that they didn't really help me. I'm bit of a noob..
I'm trying to figure out how to write the code to use the capture mode in CCP.
I looked the datasheet of my pic (PIC18f2420), and I also looked the "Using PWM with Swordfish" from the SwordfishWiki pages, but I have to admit that they didn't really help me. I'm bit of a noob..