This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADS1015: the question about converting register value

Part Number: ADS1015

Hi team,

At present, customer can read the value in the Conversion Register through I2C

Then, the value of the Conversion Register should refer to the voltage, right

If it is a voltage, how do I convert the value into the actual voltage? (Currently the setting value in the Config Register is 8483).


Suppose the value read is F48 ((0xF48-0x800)/4096)*4.096v(+/-2.048v) = 1.864v But the value is different from the actual measurement So they want to ask about the correct algorithm.

Thanks

  • Paul


    If the configuration register is set to 8483, then the input range is +/-2.048V. We can start with that.

    The ADC output is 12 bits and the conversion register is 16 bits wide. The last four bits are zeros and you would use the 12 most significant bits as the data conversion. The data is also put into two's complement notation so that negative values are represented.

    This is how I would calculate values. If the value is greater than 2^11 or 7FF, then the value is negative and I would start by subtracting 0x1000 from the 12 bit number. Then I would multiply by the positive full scale range and then divide this by 2^11.

    In your example of 0xF48, this is number is -184
    So the conversion value is -184*2.048/2^11 = -0.184V

    You can do this in excel:

    Put this into B2:
    =IF(HEX2DEC(A1)>(2^11-1), ((HEX2DEC(A1)-2^12)*2.048/2^11), (HEX2DEC(A1)*2.048/2^11))

    Then put F48 into A1. You should be able to make all the conversions you need by changing the contents of A1.


    Joseph Wu

  • Hi Joseph

    Does the actual voltage -0.184V mean the difference between AIN0 and AIN1?

    Currently, there are two inputs I used which are AIN0 and AIN1, respectively. 

    And according to the configure register is set 0x8483, the input will be AINP = AIN0 and AINN = AIN1.

    So I guess  the actual voltage -0.184V is the difference between AIN0 and AIN1, am I right?

  • Hi,

    Yes that's correct. With the configuration register set to 0x8483, this programs the device to  the following settings:

    Start a single conversion (when in power-down state)
    AINP = AIN0 and AINN = AIN1 (default)
    FSR = ±2.048 V (default)
    Continuous-conversion mode
    1600 SPS (default)

    The ADC measures the voltage from AINP-AINN, so that would be the difference from AIN0 to AIN1.

    Joseph Wu