neiltechspec
Senior Member
I'm having a bit of trouble trying to convert to to Fahrenheit & displaying to one decimal place.
Currently using the following code which displays rounded value only.
This code is an extract from whole program (indoor temp, outdoor temp, windspeed & humidity).
Any help with the maths appreciated.
Neil.
Currently using the following code which displays rounded value only.
Code:
readtemp12 insens,temp12 ;read raw into temp12
if temp12 = 0 then ;check if DS18B20 responding
pause 750
serout tcpip,baud,("Indoor Sensor not found",cr,lf)
return
endif
sign = 43 ;sign is "+"
if temp12 > 2048 then ;check for below 0 deg
sign = 45 ;if temp is below 0 sign is "-"
let temp12 = - temp12 ;two's compliment
endif
adjtemp = temp12 * 10 / 16
bintoascii adjtemp,b25,b26,b27
serout tcpip,baud,("Indoor Temp: ",sign,b25,b26,".",b27,$b0,"C")
fht=adjtemp /10 *9 /5 +32 ;fahrenheit conversion
serout tcpip,baud,(" (",#fht,$b0,"F)",cr,lf)
return
Any help with the maths appreciated.
Neil.
Last edited: