Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Device Scaling Coefficients

Hello All,
 
I've noticed that the  Analog Input >> General Properties >> Advanced >> Device Scaling Coefficients property can return an array with a variable number of coeffiecients, depending on the board type (either E series or M series) and perhaps the physical ADC channel as well, although i have not tested this. 
 
Is there anyway to know the number of coeffs before calling DAQmxGetAIDevScalingCoeff()?  Or, what is the maximum number of coeffs that NIDAQmx will use.
 
Also, I assume the polynomial is of the form Coeff_0 + Coeff_1*x + Coeff_2*x^2 + Coeff_3*x^3 ....
 
Thanks,
Brady
0 Kudos
Message 1 of 6
(4,136 Views)
The documentation for the calls to get properties is mighty sketchy, eh?

I see there's an input to DAQmxGetAIScalingCoeff to tell it the array size. Some of the DAQmx calls that take an array to be filled will take a NULL array, and the return value is the size you need. I wonder if this one works that way...

We need:

1) an NI engineer who knows the code to answer this, since the "documentation" for the function is a one-liner, and all it says is that the function "gets the value of the property" (my paraphrasis).

2) better documentation for the properties.
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 2 of 6
(4,125 Views)

Hi John -- I couldn't agree more about documentation of the properties.  Right now, its sort of a mess.

In NIDAQmx.h - the definition is:

int32 __CFUNC DAQmxGetAIDevScalingCoeff(TaskHandle taskHandle, const char channel[], float64 *data, uInt32 arraySizeInSamples);

Unfortunately, arraySizeInSamples is a pass by value, not a reference, so the NULL trick won't work.  I would be happy just knowing the maximum number of coeffs so I could make a standard size array.

Brady Trexler

 

0 Kudos
Message 3 of 6
(4,120 Views)
Well, I was thinking of DAQmxGetExtendedErrorInfo- if you pass NULL for the buffer, or zero for the buffer size, the return value of the function is the required buffer size. Note that the buffer size here is also pass by value. It's the return value that is usually an error code, but is doing double-duty as the buffer size return under certain circumstances.

I don't like the double duty much, but it's better than not being able to get the information...
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 4 of 6
(4,117 Views)

John, you are correct.

int32 __CFUNC DAQmxGetAIDevScalingCoeff(TaskHandle taskHandle, const char channel[], float64 *data, uInt32 arraySizeInSamples);

returns the number of coeffs when called with NULL for the data parameter.  I also set arraySizeInSamples = 0, although I'm not sure whether that has any bearing on the result.
 
Thanks for your help.
 
Best regards,
Brady
0 Kudos
Message 5 of 6
(4,110 Views)
Wow. That was a lucky guess!

That is *definitely* something that should be documented. This isn't the first post I've made pointing out that the documentation is terrible.
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 6 of 6
(4,105 Views)