Since ntc could be 0 or 1023 maximum, the condition if tb0>=16170 then is always false so tbo will be always zero and tb1 will be never setted with your required calculation tb1=tb0-16170.Code:From your code: ADCIN 1,ntc tb0=ntc if tb0>=16170 then tb1=tb0-16170 ELSE tb0=0 ENDIF
Cheers
Al.
Bookmarks