3. set initial PWM duty cycle by writing to CCPR1L:CCP1CON<5:4>
4. enable timer2 int (TMR2IF=0,TMR2IE=1)
5. change PWM duty cycle as you like by writing to CCPR1L:CCP1CON<5:4> during TIM2 ISR. Goto 4.
conceptually, are the above algo correct? my application is to generate different duty cycle of PWM by user request. so can i do it following the algo above by changing the duty cycle during ISR?