manikandanshine
Full Member level 1
i studied basic concept about ccp module.but i want is,where this module can be used.anybody have sample coding.plz post it......
thanks in advance....
thanks in advance....
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
void main() {
PORTC = 0;
TRISC = 0;
PR2 = 249; //4kHz frequency of PWM @ 4MHz clock
CCPR1L = 62; //~25% duty cycle
CCP1CON = 0x0C; //PWM mode
TMR2ON_bit = 1; //Turn Timer 2 on
while(1);
}
ya. its OK... But i didn't vary the duty cycle in 0 to 127.
above 60 duty cycle value, High output will come. didn't change anything.what is the problem?
CCPR1L = data >> 2; //CCPR1L = data/4;
modo = data % 4; // either 0, 1, 2 or 3
modo = modo << 4;
CCP1CON = 0b00001100 | modo;