NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to access double* (An array) variable of C in TestStand

Solved!
Go to solution

Hi, 

 

I'm trying to access an array of numbers measured by DMM multipoint read operation. The expected data is double [] (an array of measurements as defined by "ividmm.dll") but when "nidmm_32.dll" (NI IVI driver) is used to perform the same operation, the data is returned as double* (from CVI/C code). Although double[] and double * would mean the same. 

 

The problem am facing is the array defined "Locals.Reading" defined in TestStand holds good only when it used with "ividmm.dll" and not with "nidmm_32.dll".

The DLLs used and sample sequence files are also attached. The step name where error occurs is "Read Multipoint" with readingsArray Parameter.

 

Any help/suggestion to access both these types of data types in TestStand would be greatly appreciated. 

 

Note: TestStand version: 4.0 

 

Thanks,

Manohar

 

0 Kudos
Message 1 of 5
(3,270 Views)
Solution
Accepted by Mrm

Note that the parameter readingArray is declared with Category of Numeric and Pass set to By Reference when you use the niDMM_ReadMultiPoint function, but when you use the IviDmm_ReadMultiPoint function it has Category of Array of Numbers.

 

I suspect that the function type information stored in nidmm_32.dll is incorrect for the  niDMM_ReadMultiPoint function. To test this theory, manually change the type of the parameter to Array of Numbers and see if that works.

 

0 Kudos
Message 2 of 5
(3,261 Views)

Thank Erik,

Your suggestion did the trick and it solved the problem. Though now I'm facing another issue.

The array variable declared in TestStand though declared to take size dynamically based on the number of samples selected to be read for ReadMulipoint step, the size (length) of the array variable is still zero.

Just to try, I declared the array size while creating the variable. It succeed and the data measured is entered into the array. Am I missing anything here??

 

Suggestions welcome.

Attached is the modified example that works, but with array size manually defined. I would like the array size to be dynamically set based on the number of measurements.

 

Thanks,

Manohar

0 Kudos
Message 3 of 5
(3,212 Views)

The CVI adapter does not modify the size of the arrays passed as function parameters, so you must set the size of the array before calling the function. One way to do this is with a Statement step with this expression: SetNumElements(Locals.dDMMreadingArray, Locals.SampleCount).

 

0 Kudos
Message 4 of 5
(3,196 Views)

Thanks Erik for the help.

 

Regards

Manohar

0 Kudos
Message 5 of 5
(3,175 Views)