and also,
CCPR1L contains the upper 8 bits of the 10 bit Duty Cycle value CCP1CON<5:4> contain the lower 2 bits
How to divide the 8 bits and 2 bits in calculation?
- - - Updated - - -
I have formula and i got a pwm in standard data but i am confused,about automatic calculation in program?
CCP1CON<5:4> are the LSBs. You may think of them as "decimal places". Unless that much accuracy is required, you may avoid the use of CCP1CON<5:4> and only work with the 8-bits of CCPR1L.
What is the varying data that you receive? A better description of the data would help.
You have to remember that the duty cycle is a percentage of the Period Register (PR2) and the calculation must take this into account.