Thanks for the input.
Unfortunatly I'm using a DS18S20, and not DS18B20, so don't think the DIV32 route will work.
Also, I only used 1's compliment as the LSB is truncated. Basically I wondered if the equation in the DS18S20 datasheet was still valid for negative values of TEMP_READ, if I converted it to the Absolute (positive) value using XOR, or do the values within COUNT_REMAIN and COUNT_PER_C affect the result, also would I have to reverse the addition and subtraction sign? eg
IF temperature.15=1 then
temperature=temperature XOR %1111111111111111 'convert to possitive value
' Calculate temperature in degrees C to 2 decimal places (for negative temperature)
temperature = (((temperature >> 1) * 100) + 25) - (((count_per_c - count_remain) * 100) / count_per_c)
ELSE
' Calculate temperature in degrees C to 2 decimal places (for positive temperature)
temperature = (((temperature >> 1) * 100) - 25) + (((count_per_c - count_remain) * 100) / count_per_c)
ENDIF
Bookmarks