2.6.2 - Converting Binary Readings to Voltages [U6 Datasheet] | LabJack

# 2.6.2 - Converting Binary Readings to Voltages [U6 Datasheet]

This information is only needed when using low-level functions and other ways of getting binary readings. Readings in volts already have the calibration constants applied. The UD driver, for example, normally returns voltage readings unless binary readings are specifically requested.

 Gain Max V Min V Bipolar 1 10.1 -10.6 Bipolar 10 1.01 -1.06 Bipolar 100 0.101 -0.106 Bipolar 1000 0.0101 -0.0106

The readings returned by the analog inputs are raw binary values (low-level functions). An approximate voltage conversion can be performed as:

Volts(uncalibrated) = (Bits/65536)*Span

Where span is the maximum voltage minus the minimum voltage from the table above. For a proper voltage conversion, though, use the calibration values (Slope and Offset) stored in the internal flash on the Control processor.

Volts = (Slope * Bits) + Offset

In both cases, “Bits” is always aligned to 16-bits, so if the raw binary value is 24-bit data it must be divided by 256 before converting to voltage. Binary readings are always unsigned integers.

Since the U6 uses multiplexers, all channels have the same calibration for a given input range.

See Section 5.4 for details about the location of the U6 calibration constants.

### I am having trouble with

I am having trouble with something that is confusing the hell out of me. What is the difference between the gain index in this function: d.binaryToCalibratedAnalogVoltage(gainIndex=1, bytesVoltage=ainBits[0], is16Bits=False) and this one: d.getFeedback(u6.AIN24(PositiveChannel=1, ResolutionIndex=8, GainIndex=15))? I'm trying to read voltages from multiple wheatstone quarter-bridges and trying to get the best resolution for single-ended readings.

Here is a sample of the code I'm using:

d = u6.U6()

d.getCalibrationData()

channels = 12

feedbackArguments = []
for i in range(channels):
feedbackArguments.append(u6.AIN24(PositiveChannel=i+1,
ResolutionIndex=8, GainIndex=100))

while True:
for i in range(channels):
ainBits = d.getFeedback(feedbackArguments[i])
v = d.binaryToCalibratedAnalogVoltage(gainIndex=-2,
bytesVoltage=ainBits[0], is16Bits=False)
print v
time.sleep(0.1)

### The gain indexes map to the

The gain indexes map to the following gains:

0 = x1 (±10V), 1 = x10 (±1V), 2 = x100 (±0.1V), 3 = x1000 (±0.01V)

The gain index you pass to AIN24 should be the same one you pass to binaryToCalibratedAnalogVoltage for proper calibration to be applied. Note that gain index 15 (autorange) was disabled starting in firmware version 1.13, so use only gain indexes 0-3.

"What is the difference between the gain index in this function: d.binaryToCalibratedAnalogVoltage(gainIndex=1, bytesVoltage=ainBits[0], is16Bits=False) and this one: d.getFeedback(u6.AIN24(PositiveChannel=1, ResolutionIndex=8, GainIndex=15))?"

gainIndex=1 is gain x10 and GainIndex=15 is auto-range which is no longer supported.

As for your code, if you wanted a gain of x100 pass a gain index of 2 for both AIN24 and binaryToCalibratedAnalogVoltage.

The AIN24 class documentation provides gain indexes along with the AIN24 low-level documentation:

http://labjack.com/support/u6/users-guide/5.2.5.2