Electronics > Microcontrollers

Reading PWM signal in PIC micro


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

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)



[0] Message Index

There was an error while thanking
Go to full version