PWM Output Control

I was wondering what I need to do if I select USER control on a non-CPP pin, or if I select USER and IFI_PWM on a cpp pin. With the period set up the way you do it (in your example code), if CCPR2L were set to 0xFF, the pwm duty cycle would exceed the period. Would this have an adverse effect on the machine?

**If you select USER control on a non-CCP pin (PWM Outputs 5 - 8), you must write your own code to control those pins. Selecting USER control on a CCP pin (PWM Outputs 1 - 4) and IFI_PWM, will generate the same PWM Signals that the Master would have generated if you use Generate_PWM(…). If Generate_PWM(…) is not called under this situation, the output pins will not be controlled.

Note: When using USER control, the PWM signals are interruptible which can cause stretching of the PWM Output signal, whereas with the MASTER control they are non-interruptible. For more details on the CCP pin, refer to page 154 of the PIC18FXX20 Data Sheet.**


Ricky Torrance
Electrical Engineer
VexLABS

I see from the code you guys posted that motor outputs one through four come from the CCP outputs of the user microcontroller. since there are only five such outputs on the 18f8520, I was wondering if motors five through eight are controlled in software or if they are controlled by the master?

All the PWM Outputs can be controlled by either the Master or User Processor. This is selectable in the User Code. Only the User Processor has some of the PWM outputs connected to the CCP pins. This gives you the flexibility to create your own PWMs for your specific application or you can let the Master generate standard PWM outputs for you.