NI Home > Community > NI Discussion Forums

NI TestStand

Reply
Member Mrm
Member
Mrm
Posts: 17
0 Kudos
Accepted Solution

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

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

 

Member
Erik_Crank
Posts: 111
0 Kudos

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

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.

 

Member Mrm
Member
Mrm
Posts: 17
0 Kudos

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

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

Member
Erik_Crank
Posts: 111
0 Kudos

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

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).

 

Member Mrm
Member
Mrm
Posts: 17
0 Kudos

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

Thanks Erik for the help.

 

Regards

Manohar