Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

Need help with DAQmxGetDevAIGains

Could someone please give me an example of how to use DAQmxGetDevAIGains?  Like many functions in the DAQmx C API, I can find only the barest of documentation.  The documentation shows:


    int32 __CFUNC DAQmxGetDevAIGains(const char device[], float64 *data, uInt32 arraySizeInSamples);


        DAQmxGetDevAIGains gets the I/O Type >> Analog Input >> Gains property


I tried using it like so:


    double gains[32];

    int err = DAQmxGetDevAIGains("PXI2Slot2", gains, 32);


where the device at PXI2Slot2 is a PXI-6250.  The call returns with err == 0, but the gains array is filled with garbage (-7.8e+298).  I've already created a task and at least one AI channel before I try to get the gains.  What am I doing wrong?





0 Kudos
Message 1 of 4

Hi Larry,

I am familiar with a similar property that I can use withoput problem in LabVIEW. Let me if I can find an example in C that will help us figure out what you are doing wrong. I will post back monday afternoon with an update.


What environment are you programming in? If you would like to, you could also post your code and I can take a look at it.



Mallori M
National Instruments
Sr Group Manager, Education Services
0 Kudos
Message 2 of 4

AI Gain is pretty much only used on SCXI devices so when you query it for for available gains on a regular DAQ card it just returns an empty array. What you're probably looking for is DAQmxGetDevAIVoltageRngs().



Andrew S

0 Kudos
Message 3 of 4

Hi Larry,

He makes a good point. I believe I have only used the Gains property node with Dynamic Signal Acquisition (DSA) cards and SCXI in the past. Some links that you might find helpful with regards to DAQmxGetDevAIVoltageRngs() are:

Format of DAQmxGetDevAIVoltageRngs

how to list AI input ranges by daqmx

I hope this helps,


Mallori M
National Instruments
Sr Group Manager, Education Services
0 Kudos
Message 4 of 4