Gast
#428005
Hallo,
ich habe diese Funktion
bool set_pwm_rate(struct luefter *l, int percent_output){
if(l->pwmrate >= 0 && l->pwmrate <= 100){
OCR1A = (uint16_t) percent_output / 100.0 * 255.0;
OCR1B = (uint16_t) percent_output / 100.0 * 255.0;
l->pwmrate = percent_output;
return(true);
} else {
return(false);
};
}
und folgendem Funktionsaufruf aus einem anderen Sourcemodul:
set_pwm_rate((struct luefter *) &luefter1,luefter1.pwmrate+1);
der Compiler liefert mir folgende Warnung:
../pwm.c:13: warning: comparison is always true due to limited range of
data type
damit ist if(l->pwmrate >= 0 && l->pwmrate <= 100) gemeint.
Ich werd daraus nicht ganz schlau. Kann mir das vielleicht jemand
erläutern?
Christian