I need to extend the range of the DS18S20 below zero, to one decimal place. My current program uses the "onewire.bas" routine to calculate this:
' Calculate temperature in degrees C to 2 decimal places (not valid for negative temperature)
temperature = (((temperature >> 1) * 100) - 25) + (((count_per_c - count_remain) * 100) / count_per_c)
Lcdout $fe, 1, DEC (temperature / 100), ".", DEC2 temperature, " C"
Is it possible for negative temperatures to just XOR before the calculation. i.e.
IF temperature.15=1 then
temperature=temperature XOR %1111111111111111 'convert to possitive value
endif
Or am I missing something?
Bookmarks