The DS18B20 gives good readings if you want only whole degress in Centigrade. After searching the fora(ums??) I just want to confirm I understood correctly. To get higher resolution temperature readings you have to use a WORD variable(12bits) - fine. The calculation to get 1 decimal (0.1 deg C) from this will then be:
Negative temp's requires the inverse & 4095 +1 as below:readtemp12 pinx,temp
sign= 43 ; = "+"
temp= temp*10 / 16 ; x10 = 1 decimal(0.1) resolution
whole= temp / 10
deci = temp // 10
'now send WHOLE and "." and "DECI" to firmware chip and LCD...
'-----------------------------------------------------------------
I understand the INV(ert) bit. Can someone please explain what happens with the "AND" then "+1" part. Is that not the same as +4096 (12bits) ? What correction is made by adding 1 later ?readtemp12 pinx,temp
sign= 43 ; ="+"
IF temp> 2048 THEN ; below zero...
sign= 45 ; ="-"
temp= INV temp
temp= temp AND 4095 + 1 ;mask off top 4 bits,add 1 for correction
ENDIF