I have a temperature sensor design that I'm using as a reference. It takes 2 RTD sensors and reads their values with a Dual Channel 16-bit Differential ADC. The ADC interfaces through the SPI bus.
I know for a general ADC you can take the formula:
Voltage on Pin (in mV) = [(ADC Value) * (System Voltage in mV)]/(Max ADC Value)
I'm just not sure how it directly applies to a differential ADC
Here is my reference code (applicable to only one of the channels):
//--------------------------------------------------------------
// Temperature in degrees C
//
// Platinum (3850 ppm/K) RTD sensor
// 0 to 850 degrees C, Rt = R0(1 + A*t + B*t^2)
// Rt = resistance at temperature (degrees C)
// R0 = is resistance at 0 degrees C, which is 1,000 ohms
// A = 3.9083 * 10^-3
// B = -5.775 * 10^-7
//
// (R0 * B)t^2 + (R0 * A)t + (R0 - Rt) = 0
//
// Quadradic Equation: ax^2 + bx + c = 0
// x = (-b +/- SQRT(b^2 - 4ac)) / 2a
//
// therefore:
// (-(R0 * A) +/- SQRT((R0 * A)^2 - (4 * (R0 * B) * (R0 - Rt))
// t = -----------------------------------------------------------
// 2 * (R0 * B)
//
// (-3.9083 +/- SQRT(15.2748 - ((-2.3104 * 10^-3) * (1,000 - Rt)))
// = ------------------------------------------------------------------
// -1.1552 * 10^-3
{ float Vr, Rt;
Vr = ((ADC_Meas * 1.25) / 32768.0) + 2.5;
Rt = (1000.0 * Vr) / (5.0 - Vr);
t = ((-3.9083) + sqrt(15.2748 - (-0.0023104) * (1000.0 - Rt))) / (-0.0011552);
}
//--------------------------------------------------------------
What I'm trying to understand is how the two formulas for the Vr and Rt were devised?
Also I am still a little bit confused about how the differential ADC works.
I believe in a typical ADC we give the REF+ and REF- voltages and the resulting reading for a given channel is the ratio of how close it is to REF+ starting from REF-.
For example for a regular 16-bit adc a reading of 0 would mean our input is 0 (or equal to REF-) and a reading of 65536 would mean our channel is equal to REF+.
I suppose what I'm confused about is how a differential ADC relates to the standard ADC. based on the standard ADC example I would think that the input value must stay inside the REF-/+ values but from the example circuit I have for a differential ADC it seems that this is not necessarly the case. So how do I know what the ADC is tied to and how to associate it with the REF values?