rtowler
11-28-2006, 02:38 AM
I'm trying to calibrate an AD592 temp sensor following the example in the Applied Sensors (v1.4) book but have run into a frustrating problem. The circuit is set according to the schematic on pg. 66. The one difference is that I am using the uFPU floating point co-processor to do the calculations. I don't *have* to use it, but it is on-board due to another requirement of the project and I would like to use it. I also have the DS1620 on-board. The stamp is a BS2p24.
Everything is working fine, but I cannot calibrate this. I have created my ice bath, and I am reporting both the raw value from RCTIME and the calculated temperature. Following the text on pages 69-70 I take the raw value and multiply it by 273 to get my calibration constant. I then alter my uFPU code (the values passed to FWRITEB) to insert the constant. I reprogram the Stamp and... the raw value reported from RCTIME changes. Humm, ok. recalculate the calibration constant, change the uFPU code, reprogram and the value changes back!
The raw value reported from RCTIME changes back and forth between say 1100 and 1120 and definitely is related to the value I plug in as the calibration constant. I know this sounds insane. I can't imagine why this would happen but nothing is changing with regards to the setup. I have also tried reprogramming the stamp over and over with the same cal constant thinking that maybe the act of programming the stamp had something to do with it. Nope. But changing the value of the calibration constant *always* changes the value returned by RCTIME. When running, the values are reasonably stable, but the problem is that I can't get a good cal of the sensor.
I understand that I could add a 2nd calibration parameter (offset) to compensate for this but the real issue here is understanding what is going on so I can trust my code and the stamp. Is there any explanation for this behavior?
Since I am using the uFPU, the code is a bit different than found in the book:
' Get the raw temp value from AD592
LOW AD592
RCTIME AD592, 0, rawTemp
SEROUT SerPin, SerMode, ["Raw AD592 Val: ", DEC rawTemp, CR, LF]
' Divide calibration constant by rawTemp value (constant = 303030)
SHIFTOUT FpuOut, FpuClk, MSBFIRST, [um_RawTemp, FWRITEB, $48, $93, $F6, $C0, FSET,
LOADWORD, rawTemp.HIGHBYTE, rawTemp.LOWBYTE, FDIV]
' subtract 273 to convert from deg K to Deg C
SHIFTOUT FpuOut, FpuClk, MSBFIRST, [um_RawTemp, FWRITEB, $C3, $88, $80, $00, FADD]
' display results
SEROUT SerPin, SerMode, ["AD592 Temp (deg c): "]
SHIFTOUT FpuOut, FpuClk, MSBFIRST, [um_RawTemp]
format = 81
GOSUB Print_FloatFormat
SEROUT SerPin, SerMode, [CR, LF]
Many thanks for any input.
Everything is working fine, but I cannot calibrate this. I have created my ice bath, and I am reporting both the raw value from RCTIME and the calculated temperature. Following the text on pages 69-70 I take the raw value and multiply it by 273 to get my calibration constant. I then alter my uFPU code (the values passed to FWRITEB) to insert the constant. I reprogram the Stamp and... the raw value reported from RCTIME changes. Humm, ok. recalculate the calibration constant, change the uFPU code, reprogram and the value changes back!
The raw value reported from RCTIME changes back and forth between say 1100 and 1120 and definitely is related to the value I plug in as the calibration constant. I know this sounds insane. I can't imagine why this would happen but nothing is changing with regards to the setup. I have also tried reprogramming the stamp over and over with the same cal constant thinking that maybe the act of programming the stamp had something to do with it. Nope. But changing the value of the calibration constant *always* changes the value returned by RCTIME. When running, the values are reasonably stable, but the problem is that I can't get a good cal of the sensor.
I understand that I could add a 2nd calibration parameter (offset) to compensate for this but the real issue here is understanding what is going on so I can trust my code and the stamp. Is there any explanation for this behavior?
Since I am using the uFPU, the code is a bit different than found in the book:
' Get the raw temp value from AD592
LOW AD592
RCTIME AD592, 0, rawTemp
SEROUT SerPin, SerMode, ["Raw AD592 Val: ", DEC rawTemp, CR, LF]
' Divide calibration constant by rawTemp value (constant = 303030)
SHIFTOUT FpuOut, FpuClk, MSBFIRST, [um_RawTemp, FWRITEB, $48, $93, $F6, $C0, FSET,
LOADWORD, rawTemp.HIGHBYTE, rawTemp.LOWBYTE, FDIV]
' subtract 273 to convert from deg K to Deg C
SHIFTOUT FpuOut, FpuClk, MSBFIRST, [um_RawTemp, FWRITEB, $C3, $88, $80, $00, FADD]
' display results
SEROUT SerPin, SerMode, ["AD592 Temp (deg c): "]
SHIFTOUT FpuOut, FpuClk, MSBFIRST, [um_RawTemp]
format = 81
GOSUB Print_FloatFormat
SEROUT SerPin, SerMode, [CR, LF]
Many thanks for any input.