Nice one Aberco.
Promoted to article here: http://www.picbasic.co.uk/forum/cont...as-Instruments
Nice one Aberco.
Promoted to article here: http://www.picbasic.co.uk/forum/cont...as-Instruments
http://www.scalerobotics.com
Bug report on the conversion routine... should be:
Wiki article was fixedCode:TempL = TempL + 16 'adding 1 temperature unit
can also be replaced by:Code:TempDec = 0 IF TempL.7 = 1 THEN TempDec = 5000 IF TempL.6 = 1 THEN TempDec = TempDec + 2500 IF TempL.5 = 1 THEN TempDec = TempDec + 1250 IF TempL.4 = 1 THEN TempDec = TempDec + 625
Not sure what takes the longest to compute, use whichever you like.Code:TempDec = TempL * 625
Last edited by aberco; - 27th September 2010 at 16:36.
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