See this post...
Hi Fredrick,
This might help:

Originally Posted by
Darrel Taylor
Give this a try...
Code:
Sign VAR BIT
TempC VAR WORD
; read DS1820 here
Sign = TempC.15
TempC = ABS(TempC)
TempC =(TempC>>1)*10 + (TempC.0 * 5)
IF Sign then LCDOUT "-"
LCDOUT dec (TempC/10),".",dec TempC//10
<br>

Originally Posted by
sayzer
It is finally working now for the negative values.
I did not have this TempC = ABS(TempC) before TempC =(TempC>>1)*10 + (TempC.0 * 5)
But, now I get correct values.
Thanks a lot Darrel.
Regards.
http://www.picbasic.co.uk/forum/showthread.php?t=4820
-Adam-
Ohm it's not just a good idea... it's the LAW !
Bookmarks