453
void setupPWM() { T2CON = 0xFF; // Timer2 ON, prescaler = 1:16, postscaler = 1:16 PR2 = 255; // Set PR2 for Timer2 maximum count CCP1CON = 0x0C; // Set CCP1 to PWM mode (Motor A) CCP2CON = 0x0C; // Set CCP2 to PWM mode (Motor B) CCPR1L = 0; // Initialize PWM duty cycle for CCP1 CCPR2L = 0; // Initialize PWM duty cycle for CCP2 }