Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Disconnecting Hardware between VIs in multi-VI application

Solved!
Go to solution

Hello,

 

   I am currently putting together several VIs (to run as sub-VIs) to run in succession in a master VI. The first VI in this series accesses some hardware and then is supposed to disconnect once the VI has completed its run using the 'close all references' and 'close communication'. However, when the program reaches the next sub-VI in the series which requires the same hardware, the VI will not execute because it's hanging up on the hardware. I have tested that VI separately and verified that it works stand alone which leads me to the hardware conclusion.  Please advise.

 

Thanks,

 

Emma

0 Kudos
Message 1 of 4
(2,456 Views)
Solution
Accepted by topic author RockyTop

As subVIs, I would move the initialization of communications and instruments to the beginning of your top level VI.  Also move the closing to the end of top VI.  Then you pass the references to the subVIs for them to use as needed.


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 2 of 4
(2,439 Views)

Good call. Thanks!

0 Kudos
Message 3 of 4
(2,393 Views)

The other choice is to have each sub-vi as a contained package for any one instrument.  Each sub-vi when called, will open, perform an instrument task, then close the instrument each time.   This will allow the top level to handle all of the calls, display and data handling.  It becomes a question of how often will an instrument be contacted or called and is the instrument a shared resource?

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 4 of 4
(2,386 Views)