And more code cleaning... I don't need yet the part to display to LCD so that's why I haven't paid much attention to it. Works the same way but with much less resources.
Code:
TempSign VAR Byte
TempDec VAR Word
'*******************************************************
'Convert temperature to LCD
'*******************************************************
ConvertTemp:
IF TempH.7 = 1 THEN
TempSign = "-"
TempL = TempL ^ %11110000 'bitwise invert on the 4 MSB
TempL = TempL + 16 'adding 1 temperature unit
TempH = TempH ^ %11111111 'bitwise invert
IF TempL = 0 THEN
TempH = TempH + 1
ENDIF
ELSE
TempSign = "+"
ENDIF
TempDec = TempL * 625
LCDOUT $FE,1, TempSign, #TempH, ".", #TempL, "°C"
RETURN
Bookmarks