Hello, does anyone has an experience with the 18B20 temperature sensor? I have big problem, that the temperature measured with this sensor is approx. by 5 degrees celsius bigger, than the reality. Dont know why. Here is the part of code, whic I am using to compute the temperature:
OWOUT HEATING_SENSOR, 1, [$CC, $44] 'Skip ROM search & do temp conversion
Wait_Up:
OWIN HEATING_SENSOR, 4, [Busy] 'Read busy-bit
IF Busy = 0 THEN goto Wait_Up 'Still busy..?, Wait_Up..!
OWOUT HEATING_SENSOR, 1, [$CC, $BE] 'Skip ROM search & read scratchpad memory
OWIN HEATING_SENSOR, 2, [TEMP1_WORD.Lowbyte, TEMP1_WORD.Highbyte] 'Read two bytes to Temp1_word variable
CURRENT_TEMPERATURE = (TEMP1_WORD / 16)*10 'resolution is 16
TEMP1_BYTE = TEMP1_WORD // 16 'store temporarilly remainder
lookup TEMP1_BYTE, [0,0,1,1,2,3,3,4,5,5,6,7,7,8,9,9,9], TEMP2_BYTE
CURRENT_TEMPERATURE = CURRENT_TEMPERATURE + TEMP2_BYTE / here is the temperature value e.g. for 23,8 degrees celsius in this variable is 238
Bookmarks