As I understand it...
Subtracting adval-adval1 gives you positive Celcius.
Therefore adval1-adval would give you negative Celcius. The math is the same. Conversion to Farenheit is more tricky. But stop and think before you go any further...
If you Reference everything to a single numeric value... say a value of 0 in a BYTE (or WORD) variable, equals the lowest Temperature you are likely to encounter (example -100C). Do your (positive or negative math) so you have ONE positive going linear scale, from that lowest Temperature reference point. Then it's a simple matter of calculating C or F using that one variable.
Example.
Say a count of ONE of (adval-adval1) equals 1C positive then.
So...
If adval>adval1 then
TEMP=100+(adval-adval1)
else
TEMP=100-(adval1-adval)
endif
Now we have a single variable TEMP which holds a linear representation of our whole Temperature range. Now from this variable we can calculate C or F easily.
In our above example a count of 100 is 0C. Anything over 100 is positive, and anything lower than 100 is negative.
If TEMP<100 then
TEMPB=100-TEMP
LCDOut "-",#TEMPB," C"
else
TEMPB=TEMP-100
LCDOut #TEMPB, "C"
endif
Bookmarks