How to Know The Range of My Data Acquisition Device Programmatically in LabWindows™/CVI™

Updated May 3, 2018

Reported In

Software

  • LabWindows/CVI

Driver

  • NI-DAQmx

Issue Details

I have several data acquisition devices, such as PXIe 6343 and PXIe 4300.
I would like to know the analog input ranges programmatically before creating a task.


 

Solution

In order to obtain the possible ranges from your data acquisition device, in LabWindows™/CVI™ you would call DAQmxGetDeviceAttribute() and in the parameters for the function you would choose which attribute you wanted to get. 
In this case, you need to select the parameter DAQmx_Dev_AI_VoltageRngs
Here is a code example of how to know the range of two devices: 

TaskHandle  taskHandle=0;  
static float64 Range[10];
static char DeviceName[100];
static char Device1[10];
static char Device2[10];

        DAQmxGetSystemInfoAttribute (DAQmx_Sys_DevNames, DeviceName, 100);
        Scan (DeviceName, "%s>%s[xt44]%s[xt44]", Device1, Device2);  
        DAQmxGetDeviceAttribute (Device1, DAQmx_Dev_AI_VoltageRngs, Range, 10);
        DAQmxGetDeviceAttribute (Device1, DAQmx_Dev_AI_VoltageRngs, Range, 10);



 

Additional Information

According with the NI DAQmx Help:DAQmx_Dev_AI_VoltageRngs

Data Type :    float64 *
Description :    Indicates pairs of input voltage ranges supported by this device. Each pair consists of the low value, followed by the high value.
Example: If I have a device that has two ranges: +-1V , +-10V, the output will be [-1.0, 1.0, -10, 10].
 

WAS THIS ARTICLE HELPFUL?

Not Helpful