malik_zohaib
Full Member level 5
Hi guys
I am using the hi-tech compiler and above mentioned pic. I want to generate the pwm signal at pin rc2. My code is :
Crystal freq is 20MHz. I have done all this according to the datasheet (pg #60).
But the problem is my code is not generating anything. Is the code is ok?? Everything is complete? or i missed something???
Regards.
I am using the hi-tech compiler and above mentioned pic. I want to generate the pwm signal at pin rc2. My code is :
Code:
void main(){
//generate 2khz freq with 50% duty cycle at rc2.
TRISC=0;
PORTC=0;
//TMR2=0;
PR2=155;
T2CON=0x7;
CCPR1L=0x4E;
CCP1CON=0b00011111;
// CCP1X=0;
// CCP1Y=1;
while(1){
}
}
Crystal freq is 20MHz. I have done all this according to the datasheet (pg #60).
But the problem is my code is not generating anything. Is the code is ok?? Everything is complete? or i missed something???
Regards.