I am using an ADS1241 to measure thermocouple signals.

I have applied a millivolt signal differentially to channel AIN4 and AIN5 using a stable and accurate millivolt source.

The thermocouple signal ranges from -8.9 mV to 70 mV. I want to cover the whole millivolt range using this ADC.

I have set the PGA to 1.

How can I measure the negative millivolts?

I applied -10mV to the input and getting counts FF47D3 in hex. The reference is 1.235V and the format is bipolar. I am not able to decode these ADC counts.

• (1) Circuit schematic? Link to datasheet? (2) Is the device supposed to be able to read negative input voltages? (3) What is "the whole millivolt range"? – Transistor May 28 '19 at 6:58
• (1) I have provided the link to datasheet. (2) Yes the device can read differential negative millivolts but the absolute value of the voltage cannot be negative. (3) It can read millivolts from +-Vref/2 in bipolar mode. – akashk May 28 '19 at 8:09

I've never done this or worked with 24-bit numbers and a quick search reveals little. The datasheet is quiet on the topic too.

I assume that the ADC would count down past zero in the sequence

0000 0000  0000 0000  0000 0011 = 3
0000 0000  0000 0000  0000 0010 = 2
0000 0000  0000 0000  0000 0001 = 1
0000 0000  0000 0000  0000 0000 = 0
ffff ffff  ffff ffff  ffff ffff =-1


Wikipedia's gives the following example:

The following Python code shows a simple function which will convert an unsigned input integer to a two's complement signed integer using the above logic with bitwise operators:

def twos_complement(input_value, num_bits):
'''Calculates a two's complement integer from the given input value's bits'''


Trying this in a Python console ...

mask = 2**(24 - 1)
print decimal
print decimal * 1.235 / 2**23
>>>
-47149
-0.00694143950939
>>>


... which is about 7 mV.

A simpler solution depending on your microcontroller would be to left shift the number by four bits. This will preserve the two's complement but make it available to a 32-bit calculator.

0xff47d3 << 4  // results in 0xff47d300 = -12070144
Oxff47d300 / 256 = -47149


which is the same number we got using the Python method.

This seems a little odd in that the 4-bit left shift is usually considered a x 256 multiplication and then we're following it by a / 256 division so why bother? The answer is that the left shift preserves the two's compliment and the sign of the number for use by a 32-bit arithmetic logic unit. The division can then proceed correctly.

• Looks about right. – JRE May 28 '19 at 11:00