NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing 16 bit array to/from TestStand

I need to pass a large array of shorts back and forth between TestStand 3.0 and a CVI DLL(multiple times). Defining data types, the help file says I can specify 16 bit, but it's not an option on the pulldown. The Container type allows passing a C Struct, but no way to define the struct.
0 Kudos
Message 1 of 5
(3,316 Views)
Hello Bob -

If you're using 3.0, I'm pretty sure you should be able to pass the array as 16bit signed/ unsigned numbers without needing the struct.

when working with the CVI step's 'specify module' dialog, add a new parameter and on the right hand side of the screen and choose the catagory "Array of Numbers". 16bit should be an option. You can pass by pointer or value, so you might want to save memory and pass a pointer?

Working with a type definition of a struct isn't bad once you see an example of it, but I don't think you need to in this instance. If you do, let me know (or check out the shipping example).

Cheers,

Elaine R.
www.bloomy.com
Cheers,
Elaine R.
www.bloomy.com
0 Kudos
Message 2 of 5
(3,315 Views)
If one is passing a parameter, ONCE, into a DLL, that may be an option. But, my application calls for passing arrays between TestExec and the DLL multiple times. An I/O function will exist in TestExec to talk to a hardware device. Since a typical test sequence will call 30 DLL steps and arrays for input and output functions will go back and forth thousands of times for a given step. XP seems to have a problem with multiple threads talking to the same device, even if previous threads are closed, so we'd like to do the I/O from TestExec. Converting a 16 bit array to an Array of 32 bit Numbers and back to 16 bit to talk to hardware adds complexity and overhead times. So we'd like to pass a 16 bit array.
0 Kudos
Message 3 of 5
(3,317 Views)
Hmmm if passing the array by value/pointer isn't working for you, then it's definitely worth a try to pass it as a cluster. If you need to dynamically share data back and forth alot per fuction call you may want to use the ActiveX data passing methods instead?
(SequenceContext.GetNumberByOffset())

In any case, below I have attached (I hope) my simple struct example, which you might find easier than the shipping example that comes with TestStand (/Examples/StructPassing/).

I'd be interested to know if it helps.

Cheers,

Elaine R.
www.bloomy.com
Cheers,
Elaine R.
www.bloomy.com
0 Kudos
Message 4 of 5
(3,315 Views)
Bob -
You are correct in that TestStand maintains numeric values as double precision, so there is overhead when TestStand passes the data to and from the DLL. It must map the data to and from your 16 bit short array parameter. There is no way around this.

If TestStand is not operating on the data and you are not logging the data to a report or database, you could pass back a handle/pointer to the data. The only issue to contend with is that the handle/pointer will need to
be freed correctly to not loose memory, especially in the case that you terminate or abort an execution.
Scott Richardson
0 Kudos
Message 5 of 5
(3,301 Views)