All the terminology is very well defined in the manual for each chip. You should look at the appropriate chapters for the CCP module under the PWM section. This should help you configure the CCP modules properly.
Here is an example :
for the PIC16F777 Since there are 3 pwm pins available for programmers to use:
Step1: make sure that the each pins are configured correctly, (INPUT/OUTPUT)
Step2:
Set the PR2 Value: This will depend on the oscillator speed and the desired frequency you want to run your pwm channels your duty cycle is 4x the PR2 value. if you want your pwm to go from 0% to 100% in 255 steps, than your pr2 value must be 64. because 64X4 = 255.
Step3: Make sure that you are storing the value for the duty cycle in the appropriate CCPRxL (x represnts the CCP channel you are using 1, 2, or 3)
If you are still confused there is a equation in the Manual under the CCP section that explains everything in more details of what I just mentioned here. So refer to this please. I basically summarized what steps you need to take. to fulfill this.
if you are stuck, respoond here with a snip of your code and we can work something out for you.
Srig




Bookmarks