can any one please tell me what is wrong with this code ....i want to generate 50 HZ of sine pwm using the ccp module ...
#if defined(__PCB__)
#include <16C56.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=12000000)
#elif defined(__PCM__)
#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=12000000)
#elif defined(__PCH__)
#include <18F452.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=12000000)
#endif
const long sine[50] = {0,12,25,37,49,61,73,85,96,107,117,127,136,145,154,161,168,175,180,185,190,193,196,198,199,200,
199,198,196,193,190,185,180,175,168,161,154,145,136,127,117,107,96,85,73,61,49,37,25,12};
int i=0;
# INT_TIMER2
pwm()
{
if(i=50)
i=0;
//clear_interrupt(INT_TIMER2);
set_timer0(0);
set_pwm1_duty(sine);
i++;
}
void main() {
setup_timer_2(T2_DIV_BY_1,254, 1);
setup_ccp1 (CCP_PWM);
set_pwm1_duty(100);
enable_interrupts(GLOBAL);
enable_interrupts(INT_TIMER2);
}