ADC reading high

Started by geekfarmer October 1, 2011
I am working on a t-stat and am having an issue with the ADC on a BX24. It is reading about 0.5 V high. My ckt is a 1 mA current source and a PTC diode. Checked by adding a resistor on one channel and a 2.5 V reference doide on an other. Both read high. If I tie a line to the gnd or +5V rail it read correct. Below is my code. I have the code running as a function called by a task. Do I have a bad BX24 or is the accurcy of the BX? Thanks.

Function ReadProbe (ByVal PinNo as byte) as Single

Dim ProbeVal as Integer ' The Probe Voltage
Dim R as Single 'Scale value returned to get the voltage
Dim RefV as Single 'Reads the 2.5 Volt Reference voltate.
Dim ScaleFact as single ' scale the returned number 1023 = 5V

'Call GetADC(13, RefVolt)
'scaling factor. V/bit
ScaleFact = 0.00489
ProbeVal = GetADC(PinNo)
RefV = (CSng(ProbeVal)*ScaleFact)
R = (CSng(ProbeVal)*ScaleFact)/0.0011 ' Calculate the Resistance
debug.print CStr(PinNo) & " " & CStr(ProbeVal) & " " & CStr(RefV)
ReadProbe = (1.0E-12*R^4)-(8.0E-9*R^3)-(6.0E-6*R^2)+(0.1934*R)-243.18
End Function

> ... It is reading about 0.5 V high...

My first guess is that the pin pullup is on. What does a voltage
divider, the center of two 100ks in series between +5 and 0v,
indicate? Should be 2.5v, but if the pullup is on it'll be much higher.