i hope this is not a medical diagnostic deviceNow i'm trying to figure out how to add the remainder in the command.
your temperature calculation is not accurate and the remainder calculation is mathematically incorrect
yields the temp in deg C to about 1 deg of resolution with an error of +- 1 degreeCode:temperature = tempir/50 ' based on the manual we need to divide by 50 or 0.02 temperature = temperature - 273 ' subtract 273 for Degree in C,actually is 273,15
calculated the 100 modulus of the temp in deg kelvinCode:remainder = (tempir*2)//100 ' multiply x 2 and get the remainder //100
adding them together is nonsense , trying to display a two decimal point result is from any of these results is just not right
display like thisCode:wtf tempir = (temp.highbyte << 8) + temp.lowbyte ;just Nooooo! its the hardest most convoluted way i have ever encountered to go tempir = temp which serves no purpose anyway don't like this either, it pisses away too much resolution hence its not particularly accurate temperature = tempir/50 ' based on the manual we need to divide by 50 or 0.02 temperature = temperature - 273 ' subtract 273 for Degree in C,actually is 273,15 remainder = (tempir*2)//100 ' multiply x 2 and get the remainder //100 ;this is good although it could be even more accurate [temperature = temp*2 - 27315 ; temp x 2 - 273.15*100 ] >==>temperature*100] if the raw value won't exceed 32768 temperature = (temp - 13657)<<1 ; (temp-[273.15*50]) x 2 <==> temperature*100; is good i make the assumption temperature * 100 is the value required by the slider display tempir and remainder are not needed
Code:'------------------------------------------------------------------------------*' IR Display 1 the parameters * '------------------------------------------------------------------------------* display: ' IR TEMP hserout2 [$73,$00,$02,$12,$00,$ff,"IR TEMP:",00] Hserin2 timeout,error,[wait(6)] hserout2 [$73,$08,$02,$12,$F8,$00,dec2 temperature/100,".",dec2 temperature//100,"*C",00] Hserin2 timeout,error,[wait(6)] gosub checksum2 hserout [$01,$0F,$00,temperature.highbyte,temperature.lowbyte,IRCS] Hserin timeout,error,[wait(6)] return '------------------------------------------------------------------------------| ' CHECKSUM IR | '------------------------------------------------------------------------------| checksum2: IRCS = 0 IRCS = $01 ^ $0F ^ $00 ^ temperature.highbyte ^ temperature.lowbyte return
then lets have a look at the i2c stuff , its not right either really
ps if negative temps are possible then additional code req


Im very happy. 


Bookmarks