5 - Low-level Functionality [U3 Datasheet]
Overview
The low-level U3 functionality and error codes are described in the low-level UD documentation. These are commands sent over USB directly to the processor on the U3. The majority of Windows users will use the high-level UD driver rather than these low-level functions.
Calibration Constants
The following 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.
The majority of the U3's analog interface functions return or require binary values. Converting between binary and voltages requires the use of calibration constants and formulas.
When using Modbus the U3 will apply calibration automatically, so voltages are sent to and read from the U3, formatted as a float.
Which Constants Should I Use?
The calibration constants stored on the U3 can be categorized as follows:
Analog Input
Analog Output
Internal Temperature
Analog Input: Since the U3 uses multiplexed channels connected to a single analog-to-digital converter (ADC), all low-voltage channels have the same calibration for a given configuration. High-voltage channels have individual scaling circuitry out front, and thus the calibration is unique for each channel. The table below shows where the various calibration values are stored in the Mem area. Generally when communication is initiated with the U3, four calls will be made to the ReadMem function to retrieve the first 4 blocks of memory. This information can then be used to convert all analog input readings to voltages. Again, the high level Windows DLL (LabJackUD) does this automatically.
Analog Output: Only two calibrations are provided, one for DAC0 and one for DAC1.
Internal Temperature: This calibration is applied to the bits of a reading from channel 30 (internal temp).
U3 Input Ranges
The U3 input ranges can be found in section 2.6.2 of the User's Guide. For your convenience, that table has been provided again below.
Nominal Analog Input Voltage Ranges for Low-Voltage Channels
| Max V | Min V |
---|---|---|
Single-Ended | 2.44 | 0 |
Differential | 2.44 | -2.44 |
Special 0-3.6 | 3.6 | 0 |
Nominal Analog Input Voltage Ranges for High-Voltage Channels
| Max V | Min V |
---|---|---|
Single-Ended | 10.3 | -10.3 |
Differential | N/A | N/A |
Special -10/+20 | 20.1 | -10.3 |
U3 Calibration Formulas (Analog In)
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 (Single-Ended)
Volts(uncalibrated) = (Bits/65536)*Span – Span/2 (Differential)
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
U3 Calibration Formulas (Analog Out)
Writing to the U3's DAC require that the desired voltage be converted into a binary value. To convert the desired voltage to binary select the Slope and Offset calibration constants for the DAC being used and plug into the following formula.
Bits = (DesiredVolts * Slope) + Offset
U3 Calibration Formulas (Internal Temp)
Internal Temperature can be obtained by reading channel 30 and using the following formula.
Temp (K) = Bits * TemperatureSlope
U3 Calibration Constants
Below are the various calibration values are stored in the Mem area. Generally when communication is initiated with the U3, eight calls will be made to the ReadMem function to retrieve the first 8 blocks of memory. This information can then be used to convert all analog input readings to voltages. Again, the high level Windows DLL (LabJackUD) does this automatically.
Normal Calibration Constant Memory Locations
Block # | Starting Byte | Name | Nominal Value | Units |
---|---|---|---|---|
0 | 0 | LV AIN SE Slope | 3.7231E-05 | volts/bit |
0 | 8 | LV AIN SE Offset | 0.0000E+00 | volts |
0 | 16 | LV AIN Diff Slope | 7.4463E-05 | volts/bit |
0 | 24 | LV AIN Diff Offset | -2.4400E+00 | volts |
1 | 0 | DAC0 Slope | 5.1717E_01 | bits/volt |
1 | 8 | DAC0 Offset | 0.0000E+00 | bits |
1 | 16 | DAC1 Slope | 5.1717E+1 | bits/volt |
1 | 24 | DAC1 Offset | 0.0000E+00 | bits |
2 | 0 | Temp Slope | 1.3021E-02 | degK/bit |
2 | 8 | Vref @Cal | 2.4400E+00 | volts |
2 | 16 | Reserved | - | - |
2 | 24 | Reserved | - | - |
Additional High-Voltage Calibration Constant Memory Locations
Block # | Byte | Name | Nominal Value | Units |
---|---|---|---|---|
3 | 0 | HV AIN0 Slope | 3.1400E-4 | volts/bit |
3 | 8 | HV AIN1 Slope | 3.1400E-4 | volts/bit |
3 | 16 | HV AIN2 Slope | 3.1400E-4 | volts/bit |
3 | 24 | HV AIN3 Slope | 3.1400E-4 | volts/bit |
4 | 0 | HV AIN0 Offset | -10.3 | volts |
4 | 8 | HV AIN1 Offset | -10.3 | volts |
4 | 16 | HV AIN2 Offset | -10.3 | volts |
4 | 24 | HV AIN3 Offset | -10.3 | volts |
Format of the Calibration Constants
Each value is stored in 64-bit fixed point format (signed 32.32 little endian, 2's complement). Following are some examples of fixed point arrays and the associated floating point double values.
{LSB, ..., MSB} | Floating Point Double |
---|---|
{0,0,0,0,0,0,0,0} | 0.0000000000 |
{0,0,0,0,1,0,0,0} | 1.0000000000 |
{0,0,0,0,255,255,255,255} | -1.0000000000 |
{51,51,51,51,0,0,0,0} | 0.2000000000 |
{205,204,204,204,255,255,255,255} | -0.2000000000 |
{73,20,5,0,0,0,0,0} | 0.0000775030 |
{255,122,20,110,2,0,0,0} | 2.4300000000 |
{102,102,102,38,42,1,0,0} | 298.1500000000 |