Hi,
I'm using stm8s903f3 board to generate a PWM of a certain frequency. In the main function I have implemented a If statement to check for a condition and then update the CCR2 value and pass it on to the PWM function that I'm calling in the If loop. There seems to a problem, the CCR2 value is not getting updated. What am I doing wrong? Here is a snippet of the code :
if( res >=1.65 && res < 1.675){
pwm = pwm_temp-25;
PWM_Combine_Start(duty_cycle_led, pwm);
} else if ( resistance >= 1.675 && resistance < 1.70){
pwm = pwm_temp-22.5;
PWM_Combine_Start(duty_cycle_led, pwm);
}
I'm using stm8s903f3 board to generate a PWM of a certain frequency. In the main function I have implemented a If statement to check for a condition and then update the CCR2 value and pass it on to the PWM function that I'm calling in the If loop. There seems to a problem, the CCR2 value is not getting updated. What am I doing wrong? Here is a snippet of the code :
if( res >=1.65 && res < 1.675){
pwm = pwm_temp-25;
PWM_Combine_Start(duty_cycle_led, pwm);
} else if ( resistance >= 1.675 && resistance < 1.70){
pwm = pwm_temp-22.5;
PWM_Combine_Start(duty_cycle_led, pwm);
}