What c complier revision are you using? I have C18 3.40..
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.
if(Duty_cycle == 0)
{
PWM1_OUT = 0;
}
#pragma interrupt ccpisr_hand
void ccpisr_hand()
{
if(PIR1bits.CCP1IF == 1)
if(PWM1_OUT == 1 ) //Will be 1 if we are at end of pulse
{
PWM1_OUT = 0;
CCPR1 = 5000 - temp; //Off time
}
else
{
if(Duty_cycle > 0 && Duty_cycle < 97)
{
PWM1_OUT = 1;
temp = 50 * (int) Duty_cycle;
CCPR1 = temp; //On time
}
else PWM1_OUT = 0;
}
PIR1bits.CCP1IF = 0; //Clear int flag
}