R rparthiban69 New Member Mar 28, 2013 #1 i need to vary pwm 0 to 255 by using com port. PR2=0x3F: // 8bit resolution //CCPxCON calculation Value=ucdata; Value=Value<<4; CCP8CON= 0b00001100 | Value; //CCPRxL calculation data=ucdata/4; // changing 128 bit resolution CCPR8L=data; this calculation is changing PWM only vary 0 to 128 only. how to vary the pwm (0 to 255) by using this calculation?
i need to vary pwm 0 to 255 by using com port. PR2=0x3F: // 8bit resolution //CCPxCON calculation Value=ucdata; Value=Value<<4; CCP8CON= 0b00001100 | Value; //CCPRxL calculation data=ucdata/4; // changing 128 bit resolution CCPR8L=data; this calculation is changing PWM only vary 0 to 128 only. how to vary the pwm (0 to 255) by using this calculation?
Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member Mar 29, 2013 #2 You just load the CCPRxL register with the 6 MSbits the 2 LSbits go in the CCPxCON ( bits 4 and 5)... Therein 8 bit resolution.. You can't load CCPRxL with a number above 0x3F ( the PR2 register) as there will be no output...
You just load the CCPRxL register with the 6 MSbits the 2 LSbits go in the CCPxCON ( bits 4 and 5)... Therein 8 bit resolution.. You can't load CCPRxL with a number above 0x3F ( the PR2 register) as there will be no output...