The MLX90614 demo (attached) is also found here at the Parallax product page:
You will see this section in the demo:
Celsius = ((27315-(temperature*2))/100)
CelsiusDec = (27315-(temperature*2))
DEBUG CRSRXY, 23, 4,"-",DEC Celsius,".",DEC2 CelsiusDec, CLREOL
DEBUG CRSRXY, 23, 3,DEC Kelvin,".",DEC1 KelvinDec,CLREOL
DEBUG CRSRXY, 23, 4,DEC Celsius,".",DEC2 CelsiusDec, CLREOL
I want to display the left digit and then the right digit of the "decimal only."
But it seems the decimal portion does not act as a normal number.
For example, if the original number is 91.42, then
f2 is 42
f2a is 92
f2b is 2
(f2a should be 4)
I tried this but it is only working on the second decimal digit and not the first.
Unfortunately there are no comments in the author's demo program.
f2 = CelsiusDec
DEBUG " f2 is ", DEC2 f2, CR
f2a = f2/10
DEBUG " f2a is ",DEC f2a,CR
f2b = f2//10
DEBUG " f2b is ",DEC f2b,CR
Any ideas how to make it work correctly?
Post Edited (humanoido) : 4/8/2009 7:05:32 AM GMT