Hi Ktarke try this as your covert program
even tho accuracry only of the sensor 5% from-10 to 85 degrees.
this will give you a bit more resolution.
and give you a negative result to
Code:Convert. IF w0 > 64655 THEN ' info - 55 degrees = 64656 ' display temp negative degrees -c w0 = - w0 ' make neg positive lol ENDIF w0 = w0* 5/8 ' do the temp pos side (0.0625) 'accuracy to 12bit (on the maths side lol) let b2=w0/10 let b3=w0//10
That was my point: no use of reading with better resolution, if only half-grade results are used.
Today I was looking at the negative conversion ,too.
And do not fully understand Your code.
I wrote one like this:
Code:
if bit3=1 then:b10=5 :endif 'detect half grade
if bit11=1 then:neglippu=1:b9= w0/16:b9= NOT b9:endif 'convert negative to positive
if neglippu=0 then:b9=w0/16 AND 127:endif
-variable "neglippu" is negative flag (word flag seems to be reserved...)
-operator NOT converts the negative binary to positive
Then I can:
serout (#b9,".",#b10," C")
OR this,if negative flag is set:
serout ("-",#b9,".",#b10," C")
It is good to keep the whole degree and half-degree separate, because in thermostat-circuits the comparisons (and actions) base themselves on the whole degrees, anyway.