NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

how to transfer a VISA resource name between Teststand and labview

I use a sequencefileload callback to initialize a serial port and transfer the resource name to teststand by storing it in the fileglobals using a type "container, Instance of type 'labviewiocontrol'
and after test using sequenfileunload callback to release that resource, it got an error that:
 
VISA Close in CloseVISAPLC.vi
VISA:  (Hex 0xBFFF000E) The given session or object reference is invalid.
 
-1073807346; User-defined error code.
 
 
 
0 Kudos
Message 1 of 9
(4,513 Views)

Hi,

You need to use the StationGlobals.

Once the SequenceFileLoad sequence has finished the execution it is finished and therefore anything stored in the FileGlobals at runtime are lost and the values you maybe seeing are the static values.

Regards

Ray Farmer

Regards
Ray Farmer
Message 2 of 9
(4,509 Views)

hi ray,

thanks for your reply. 

do you mean that even the resource name can't be used in my main sequence?

as I think the two callbacks and the main sequence are all in the same sequence file.

0 Kudos
Message 3 of 9
(4,507 Views)

Hi,

If its the Alias such "COM1" then that will be ok, but if its a handle returned by the initialise function then that will not, and looking at your error message it sounds like the later. Therefore you would have to perform the initialise in you MainSequence.

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 4 of 9
(4,505 Views)

Today I have tried to put both in the same sequence of the sequence file (to open the session first and then close the session), and still got the same failure report.

what I use to store the VISA resource name fileglobals.VISA_RESOURCE
It's a container of device name: COM1
and sessionnumber: 1642504

it's really strange and why?

0 Kudos
Message 5 of 9
(4,490 Views)
now I solve the problem, but still I don't know why.
 
I create a new sequence and copy those two vi to initialize and close VISA, it works correctly.
and I copy it back to the original sequence and replace the original one, and it's ok.
 
It's a bug in the teststand, I don't know. Maybe I have changed sth. during that operation, I don't know.
 
but it's solved.
0 Kudos
Message 6 of 9
(4,478 Views)

I apologize for resurecting an old post but ran into  "VISA: (Hex 0xBFFF000E) The given session or object reference is invalid" error with LabVIEW + TestStand.

 

I used breakpoints at various steps and launched the LabVIEW VIs in debug mode. I noticed the "Value" of the VISA resource name FileGlobal in the Variables pane was not retained after execution was completed.
This proves anything stored in the FileGlobals at runtime is lost. To summarize, I am unable to pass VISA resource name from one sequence to another as a FileGlobal in TestStand with my implementation. 

 

While searching through the forums, I came across three possible solutions. I was able to solve using the workaround suggested by Ray Farmer. i.e. use StationGlobal in TestStand for the VISA resource name. Hopefully, this helps someone.

 

Thanks,

Mohit Kapur

0 Kudos
Message 7 of 9
(3,656 Views)

In my opinion, TestStand shouldn't even be holding the VISA Resource.  It is used in LabVIEW, so LabVIEW should hold it.  Therefore, I use Action Engines to hold my references and act on them when appropriate.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 9
(3,650 Views)

The only caveat to the crossrulz is doing it is if something dynamically unloads all modules in the middle somewhere.  Then the Action Engine will no longer have the session and the next call will have to create one.  However, I do like the action engine idea.

 

Personally I hate the idea of using StationGlobals.   It requires the variable to exist.  So now you have to deploy or have some tool set up that variable on a first run.  Plus it is more prone to race conditions and coupling.  Seriously, I can do this all day... 🙂  Globals are a bad idea.

 

We use parameters.  The same way it's used in LabVIEW.  Passing the active handle around.

 

Cheers,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 9 of 9
(3,639 Views)