Patch in place..... No, that did not cancel the compile error!
Here’s the code:
Code:
READTEMP:
OWOUT PORTA.5,1,[$CC, $44] ' SEND Start Temperature Conversion command
OWOUT PORTA.5,1,[$CC, $BE] ' SEND Read Temperature command
OWIN PORTA.5,0,[STR dq\9] ' Retrieve all 9 bytes of data
RawTemp.Byte0 = dq[0]
RawTemp.byte1 = dq[1]
IF RawTemp.8 = 1 then ' Check IF temperature is a negative reading
SignC = Negative
RawTemp.lowbyte = RawTemp.lowbyte ^ 255 ' Invert data
ELSE
SignC = Positive
ENDIF
dummy = RawTemp.0 ' Store the half degree indicator bit
TempC = ((RawTemp.lowbyte) >> 1) * 100 ' Divide raw data by 2 to give real temperature
TempC = TempC + (dummy * 50) ' Add the half degree is present
IF SignC = Negative then ' Only proceed IF temperature is negative
IF TempC => 1770 then
SignF = Negative
TempF = (TempC + 5000) * 900
TempF = div32 500
TempF = TempF - 12200
RETURN
ELSE
SignF = Positive
TempF = (TempC + 5000) * 900
TempF = div32 500
TempF = 12200 - TempF
RETURN
ENDIF
ENDIF
SignF = Positive
TempF = TempC * 18 / 10 + 3200
RETURN
Thanks!
Bookmarks