PIC 30/33 pwm12.h header file problem using 2nd PWM block

Thread Starter

D.L. Johnson

Joined Jul 24, 2015
1
I came across this a year ago, and it just caused me problems again, so thought I'd note it here to save you some time.

Some PIC30 / PIC33 processors have a 2nd PWM block (for PWM's 7&8). If you try to use that you may get the following error:

warning: implicit declaration of function 'ConfigIntMCPWM2'
error: 'PWM2_INT_DIS' undeclared ..., etc.

I solved the problem by commenting out the #else on line 511 of pwm12.h. That #else prevents access to the second half of the file that deals with PWM block #2. Microchip responded to my support ticket (#266480) by admitting the problem, and promising to fix it in new versions of the library, but as far as I know it hasn't been done.

To replicate the problem:

#include <p33FJ128MC202.h>
#include <pwm12.h>

int main (void)
{
ConfigIntMCPWM1( PWM1_INT_DIS & PWM1_FLTA_DIS_INT & PWM1_FLTA_INT_PR1 & PWM1_INT_PR1 );

ConfigIntMCPWM2( PWM2_INT_DIS & PWM2_FLTA_DIS_INT & PWM2_FLTA_INT_PR1 & PWM2_INT_PR1 );
}
 
Top