I can successfully clock data out of the device, but how do I convert these output codes back to volts?
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.
I can successfully clock data out of the device, but how do I convert these output codes back to volts?
Great question! I'll use the ADS1298 for this example, but the theory can be applied to any device!
To convert output codes into volts, you must first calculate the least-significant bit size or LSB. One LSB represents the voltage weight of one code. In other words, the input voltage must change by one LSB size in order to increment/decrement the ADC output. The full-scale range (FSR) of the ADC divided by the total number codes gives you the LSB size:
LSB = FSR / (2^n - 1), where 'n' is the ADC resolution.
In the ADS1298, the differential input voltage to each ADC can range from -VREF to +VREF, so the full-scale range = 2 x VREF. Remember that there is a PGA in front of each ADC as well, so the differential input to each channel must be limited from (- VREF / Gain) to (+VREF / Gain). The LSB size is then calculated as:
LSB = (2 x VREF)/ Gain / (2^24 - 1)
Next, you must know the output data format for your ADC. The ADS1298 outputs data in binary two's complement, where 0x7FFFFF represents positive full-scale and 0x800000 represents negative full-scale.
FIGURE 1: ADS1298 Ideal Transfer Function
The most straightforward way to convert your output codes back into input voltage is to AND the data with 0x800000 and test the MSB (most-significant bit). If the MSB equals 0, simply multiply the decimal equivalent by the LSB size. If the MSB = 1, you must first subtract 2^n from the decimal equivalent, then multiply by the LSB size.
For example, using VREF = 2.5 V, N = 24 bits, and Gain = 4, we can calculate the LSB size as 74.506 nV. An output code of 0x147AE1 would correspond to an input voltage of +100 mV. Meanwhile, an output code of 0xD70A3D would correspond to an input voltage of -200 mV.
I hope this helps answer your question.
This post applies to ADS1191, ADS1192, ADS1291, ADS1292, ADS1292R, ADS1294, ADS1294R, ADS1296, ADS1296R, ADS1298, ADS1298R, ADS1299-4, ADS1299-6, and ADS1299.