# NI-DAQmx Read Raw Data Calibrated and/or Scaled in LabVIEW

Updated Apr 17, 2023

## Reported In

### Hardware

• Multifunction I/O Device

• NI-DAQmx

## Issue Details

When I am using NI-DAQmx with support for LabVIEW, is the Raw Data from the DAQmx Read.vi calibrated? How can I convert the acquired binary values to scaled values?

## Solution

When you set the DAQmx Read.vi in Raw Data 1D array mode, you will get an array of integers. Pay special attention to the relationship of resolution and integers of the device when converting binary values to scaled values. Suppose your DAQ device has a resolution of 16 bits. You should set the DAQmx Read.vi in Raw 1D U16 or Raw 1D I16 mode, or you will lose effective bits. When the reading is greater than 32767(2^15-1) in U16 mode, it means that the voltage is negative and this value is complementary code. You can convert it to a signed integer by subtracting 65536. For example, 65534 in U16 is -2 in I16. Keep in mind that Unscaled Raw Data can differ between different series of DAQ cards.

M Series and X Series
For M Series and X Series devices, the acquired raw data will be uncalibrated and unscaled. However, the calibration information and the scaling information is combined by the driver and available through the AI.DeviceScalingCoeff property of a DAQmx Channel Property Node. This property is selected by clicking Properties » Analog Input » General Properties » Advanced » Device Scaling Coefficients. The data returned by this property is an array. Each element of the array is a coefficient of a third order polynomial which can be utilized to find a calibrated and scaled voltage: f(X)=a[0]*X^0+a[1]*X^1+a[2]*X^2+a[3]*X^3 (where a[i] is an array element).

E Series
For the E Series board, the acquired raw data will be calibrated on the hardware, just not scaled. The scaling information is available through the above mentioned property node. The property node will only return an array of 2 elements. This implies that the scaling of the E Series device can be represented as a first order polynomial: f(x)=a[0]X^0+a[1]X^1.

You will notice that a[0] will always be zero for an E Series device. This also implies that a[1] is the E Series' range/resolution.

Manually Convert Binary Data to Unscaled Data
Given the resolution of your board and measurement range, the formula below shows how to manually convert acquired binary data to unscaled data (units of volts):

For Example:
1. If your voltage range is bipolar (+/- 5V), then the reading is the signed (I16) representation within the range of -32768 to 32767 for the binary reading returned.
(i.e. Vmax = 5V, Vmin = -5V, bit = 16, binary reading = -8192, voltage reading = -1.25V)
2. If your voltage range is unipolar (0-10V), then the reading is the unsigned (U16) representation within the range of 0 to 65535 for the binary reading returned.
(i.e. Vmax = 10V, Vmin =0V, bit = 16, binary reading = 8192, voltage reading = 1.25V)

Manually Convert Binary Data to Scaled Data

Using the Device Scaling Coefficient property node, you can convert the binary data to scaled data using a setup similar to the one below.