Electronics > Microcontrollers

Reading PWM signal in PIC micro

(1/1)

danielks:
Can anyone teach me what method or how am I suppose to read PWM signal in PIC ?

Psi:
i dunno much about what features are available in PICs (there's probably some that can read a PWM directly) .

But in general..

You could use one of the mcu's hardware timers and see how many counts you can get between pwm signal high/low, low/high changes.  This would give you a measurement of the pwm pulse length and you could calculate the duty cycle from that.
Depending on the specs of the micro you might be able to use a pin change interrupt to read and reset the counter.

A good idea is to look at projects people have already done. There will be lots of projects out there where people have made a mcu pretend to be a RC servo.  RC servos read a pwm signal from the RC receiver and power the motor forward or backward in order to move to the position given by the duty cycle. (there is a pot on the servo arm for position detection)

johnmx:
See:
http://ww1.microchip.com/downloads/en/devicedoc/41214a.pdf

Navigation

[0] Message Index

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod