We see something unexpected when using the ads1237 with external Vref.
We want to measure a signal between -2.5V and 2.5V.
We do this by connecting AIN3 to GND, AIN0 to our signal, and measure between AIN0 (P), and AIN3 (N).
What we tried first:
As we wanted to measure both positive and negative, we supplied -2.5V to REFN0, and 2.5V to REFP0.
The output of this clipped (as expected) above 2.5V, and below -2.5V.
However. the output was only half scale. When supplying 2.6V to AIN0, we read back ~ 3FFF000 (not 100% stable). We expected to read 0x7FFFFF.
So we did not get the full resolution here, and to calculate the Voltage, we had to multiply with a Vref of 5V, instead of our expected 2.5V.
V = 5.0V * (val/0x7FFFFF) => gives correct result
(taking care of sign extending 24 bit two-complement val)
What we then tried (and seem to work)
We supplied 0V to REFN0, and 2.5V to REFP0.
Now we do get a full scale readout (0x7FFFFF) on >= 2.5V
And our voltages can be calculated with a Vref 0f 2.5.
V= 2.5V * (val/0x7FFFFFF)
the whole range -2.5V/2.5V works, and clips at the expected voltages.
So the seconds setup seems the fix for us, still I'm posting this as we don't understand it fully, maybe we oversaw something.
Questions:
1. Shouldn't give the first setup give a full scale readout on AIN0 = 2.5V ?
2. Why gives the second setup result in higher resolution than the first one ? (as the difference between REFN0 and REFP0 is lower?)
MUX1 = 0x0
SYS0 = 0x8