I am trying to understand the I2C data format of a 24 bits ACD (LTC2485).
The data sheet says it returns 4 bytes (32 bits integer), but is unclear as to where the 24 bits I seek are located.
Here is what I do not understand :
The role of the bits 31 and 30
The two most significant bits (30, 31) are used to indicate over range or under range conditions. They are also used to tell in which "quater" of the full range the signal is located.
The documentation says: If the bit 31 is set, then the signal is between 0V and +Vref otherwise, the signal is between -Vref and 0V.
I understand this as: if the signal is between 0V and +Vref, the code is between 2^23 and 2^24 and if the signal is between -Vref and 0V the code is between 0 and 2^23.
A similar reasoning can be used for bit 30, and Vref/2. That's how binary number works. Both bits can be used to tell in which "quater" of the full range the signal is.
Form this, I guess that bit 31 is bit 23 of the signal, bit 30 corresponds to bit 22, and so on. Thus, the three first bytes should be my 24 bit code.
However, the documentation later tells:
The second bit is the most significant bit (MSB) of the result.
Which would indicate that the result is shifted by one bit. But later on:
The function of these two bits is summarized in Table 1. The next 24 bits contain the conversion results in binary two’s complement format. The remaining six bits are Sub LSBs below the 24-bit level.
Which would indicate that the result is shifted by two bits, and that bits 31 and 30 are redundant (see my explanation above).
And last, the example code provided, uses ... 32 bits instead of 24.
signed int32 x;
// Reading X
x ^= 0x80000000;
voltage = (float) x;
voltage = voltage * 5.0 / 2147483648.0;// Multiply by Vref, divide by 2^31
As a result, I feel lost. Given the 4 bytes I get (let's call them bytes 0 to 3 by order of retrieval) how do I get the voltage measured by the ADC ? What is the role of "The remaining six bits are Sub LSBs below the 24-bit level" ?
Thanks for reading me. The documentation of the part is available here. Explanations on the I2C data format are page 15.