NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

C# teststep: How to pass Visa reference to correct instrument?

Solved!
Go to solution

Hello,

in C# i created a DLL for an instrument with functions like Initialize, SetVoltage, Close.

In the Initialize function i create the object for this session with:

            RM = new ResourceManager();
            Instrument = new FormattedIO488();

 

Now i put the Initialize function in TestStand 2014SP1 as a .Net-Module-NumericLimitTest.

When opening the properties of my new step in the Type-Editor then there is a button "Default Module" where i can select the function of the C#-DLL.

 

All paramaters are shown (like VISA-Address) and also an additional parameter "Return Value" Object Reference" OUT which was added by TestStand.

-> I save this value in a StationGlobal.

 

Question is now:

If i have more than one instrument of the same type (means two or more Initialize-calls) how can i pass the saved references to the next function (SetVoltage) so that is executed on the correct instrument?

 

Thanks for help

0 Kudos
Message 1 of 3
(4,010 Views)

When i do this in C# then i have to execute a "new" to the object.

Like

MyDMM.MyDMM INST_A = new MyDMM.MyDMM();

MyDMM.MyDMM INST_B = new MyDMM.MyDMM();

MyDMM.MyDMM INST_C = new MyDMM.MyDMM();

...

...

INST_A.Initialize(IPaddress,..)

INST_B.Initialize(IPaddress,..)

INST_B.Initialize(IPaddress,..)

 

How can i do this "new" in TestStand? And how would i pass the object-names to the teststeps?

 

Thanks

0 Kudos
Message 2 of 3
(4,006 Views)
Solution
Accepted by topic author OnlyOne

Solved:

Select "Use Existing Object" un -Net Invocation and pass the saved reference in there.

0 Kudos
Message 3 of 3
(4,000 Views)