Here is a link for good tutorial of programming PIC microcontroller in C.
http://harfordhackerspace.org/2010/02/programming-pic-microcontrollers-in-c/
Motor Control using Pulse-Width Modulation (PWM)
![](https://4.bp.blogspot.com/-sXo8o5RzjyM/V07ZXWEmVAI/AAAAAAAACVI/sWb8_MymAZoIux2nrqx3UOBu74-I1PxqwCK4B/s400/PWM.png)
In this program, a jumper on Port B directly selects the PWM output. PWM output is only present if a jumper to ground is present on one the least significant 3 bits of port B.
![](https://4.bp.blogspot.com/-64bEX5d73cw/V07bfrAJVpI/AAAAAAAACVU/vjZuxfcAgGAlcWei1QUdOf4sjCdLpYptgCK4B/s400/PWM%2BC%2BProgram.png)
The program demonstrates the use of control registers to effect PWM operation. One thing to notice is the fact that the program waits for a change on the input pins before selecting a new pulse-width duty cycle and reloading CCPR1.
No comments:
Post a Comment