Voilou, gérer une PWM avec Mplab 7.4 + CCS :

Code:
int value ;

setup_ccp1(CCP_PWM);   // Configure CCP1 as a PWM

          //   The cycle time will be (1/clock)*4*t2div*(period+1)
       //   In this program clock=10000000 and period=127 (below)
          //   For the three possible selections the cycle time is:
	    //     (1/10000000)*4*1*128 =  51.2 us or 19.5 khz
	    //     (1/10000000)*4*4*128 = 204.8 us or 4.9 khz
	    //     (1/10000000)*4*16*128= 819.2 us or 1.2 khz

   
setup_timer_2(T2_DIV_BY_1, 127, 1);
                
       
    
set_pwm1_duty(value);         // This sets the time the pulse is
                             // high each cycle.  We use the A/D
                             // input to make a easy demo.
                             // the high time will be:
                             //  if value is LONG INT:
                             //    value*(1/clock)*t2div
                             //  if value is INT:
                             //    value*4*(1/clock)*t2div
                             // for example a value of 30 and t2div
                             // of 1 the high time is 12us
                             // WARNING:  A value too high or low will
                             //           prevent the output from
                             //           changing.
  }

}
good luck