BrianT
- 23rd July 2010, 08:57
I am having troubles with the DS1629 combined RTC and temperature sensor. The DS1629 consistently reads about 1.5 C higher than the temperature sensor in an Intersema pressure/temperature sensor. Same results for 20 systems, both devices on same PCB.
Has anyone used the 'high resolution' mode in the DS1629? This gets 0.1 resolution against the simple DS1629 that only gives 0.5 C resolution.
The DS1629 mentions the slope and remainder registers as being 8 bits. The DS1629 datasheet refers to AN105 but AN105 nowhere mentions the DS1629 in the list of supported devices. AN105 refers to the slope and remainder registers as 9 bits and suggests using an undocumented instruction.
Viewed in isolation, my DS1629 results seem excellent with 0.1 resolution and excellent monotonicity during heating or cooling but the results are all offset about 1.5 degrees compared to a separate sensor. Both manufacturers claim high accuracy, much better than the difference I am seeing.
If anyone has code for the high accuracy version I s=would like to see it.
My code is posted below.
/code
'DS1629 subroutines
ReadDS1629:
'OneShot: ' Only read on demand
' write to $AC
' MSB = %00000101 No Time Alarm, active LOW, Temp convert on demand
' LSB = %00000000 A read only register - don't bother to write it
i2cwrite SDA, SCl, %10011110, $AC, [ %00100101]
'StartConversion: ' write to $EE
i2cwrite SDA, SCl,%10011110, [ %11101110] ' write to $EE
pause 2000 'wait convert time for DS1629 - adds to microphone settling
'ReadTemp: '$AA ' reading a word variable after writing to $AA
i2cread SDA, SCl, %10011110, $AA, [a,b]
'ReadCntRem: '$A8
i2cread SDA, SCl, %10011110, $A8, [c]
'ReadCntPerC: '$A9
i2cread SDA, SCl, %10011110, $A9,[d]
'StopConversion:
i2cwrite SDA, SCl, %10011110, [$22]
CalcTemp:
'' Temperature = TempRead - 0.25 + (CntPerC - CntRemain)/CntPerC
'' 10x temperature = (40*TempRead - 10)/4
'' now allow for integer truncation
'' 100 x Temp = gives two decimal places
' A = tempread = boxtemp >> 1 ' drop off lowest 0.5 degree value
' C = CountRemain, D= Slope = Count per C
'
' if cntperc > cntremain then
if D > C then
' u = 100*(cntperc - cntremain)/cntperc
u = 100*(d - c)/d
' ' should be 0~99 after integer truncation
' v = ((400 * tempread - 100)/4 + u +5)/10
v = ((400 * a - 100)/4 + u + 5)/10
' v = ((400 * a - 100)/4 + u )
else
' u = 100*(cntremain - cntperc)/cntperc
u = 100*(c - d)/d
' v = ((400*tempread - 100)/4 - u +5)/10
v = ((400*a - 100)/4 -u +5)/10
' v = ((400*a - 100)/4 -u )
endif
' temperature = v this is X10 so 297 means 29.7 Celsius
' u = v//10 'decimal result
' w = v/10 'numerals
return
/endcode
Has anyone used the 'high resolution' mode in the DS1629? This gets 0.1 resolution against the simple DS1629 that only gives 0.5 C resolution.
The DS1629 mentions the slope and remainder registers as being 8 bits. The DS1629 datasheet refers to AN105 but AN105 nowhere mentions the DS1629 in the list of supported devices. AN105 refers to the slope and remainder registers as 9 bits and suggests using an undocumented instruction.
Viewed in isolation, my DS1629 results seem excellent with 0.1 resolution and excellent monotonicity during heating or cooling but the results are all offset about 1.5 degrees compared to a separate sensor. Both manufacturers claim high accuracy, much better than the difference I am seeing.
If anyone has code for the high accuracy version I s=would like to see it.
My code is posted below.
/code
'DS1629 subroutines
ReadDS1629:
'OneShot: ' Only read on demand
' write to $AC
' MSB = %00000101 No Time Alarm, active LOW, Temp convert on demand
' LSB = %00000000 A read only register - don't bother to write it
i2cwrite SDA, SCl, %10011110, $AC, [ %00100101]
'StartConversion: ' write to $EE
i2cwrite SDA, SCl,%10011110, [ %11101110] ' write to $EE
pause 2000 'wait convert time for DS1629 - adds to microphone settling
'ReadTemp: '$AA ' reading a word variable after writing to $AA
i2cread SDA, SCl, %10011110, $AA, [a,b]
'ReadCntRem: '$A8
i2cread SDA, SCl, %10011110, $A8, [c]
'ReadCntPerC: '$A9
i2cread SDA, SCl, %10011110, $A9,[d]
'StopConversion:
i2cwrite SDA, SCl, %10011110, [$22]
CalcTemp:
'' Temperature = TempRead - 0.25 + (CntPerC - CntRemain)/CntPerC
'' 10x temperature = (40*TempRead - 10)/4
'' now allow for integer truncation
'' 100 x Temp = gives two decimal places
' A = tempread = boxtemp >> 1 ' drop off lowest 0.5 degree value
' C = CountRemain, D= Slope = Count per C
'
' if cntperc > cntremain then
if D > C then
' u = 100*(cntperc - cntremain)/cntperc
u = 100*(d - c)/d
' ' should be 0~99 after integer truncation
' v = ((400 * tempread - 100)/4 + u +5)/10
v = ((400 * a - 100)/4 + u + 5)/10
' v = ((400 * a - 100)/4 + u )
else
' u = 100*(cntremain - cntperc)/cntperc
u = 100*(c - d)/d
' v = ((400*tempread - 100)/4 - u +5)/10
v = ((400*a - 100)/4 -u +5)/10
' v = ((400*a - 100)/4 -u )
endif
' temperature = v this is X10 so 297 means 29.7 Celsius
' u = v//10 'decimal result
' w = v/10 'numerals
return
/endcode