I may be over simplifying it but, if the TEMP value is within the adjustment range of 105 and 170, it seems that the IF/THEN condition would fine tune your PWM signal already.
I also notice the DUTYCYCLE math needed the parentheses moved.
Code:IF TEMP > 105 AND TEMP < 170 THEN DUTYCYCLE = (170-TEMP)/3 + 222 ELSE DUTYCYCLE = 0 ENDIF
Bookmarks