LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

System resource reference automatically closed after VI finishes executing?

Solved!
Go to solution

I have a functional global variable containing an array of references to system resources obtained from the nisyscfg\Find Hardware.vi

Find devices.png

 

The first time it runs, the array is empty, then the "Find Devices.vi" subVI finds all system resources using a custom filter. This is working well. It then filters out the specific device specified by the "Product Name" input. Still ok.

 

The problem comes when I run the VI again. Since the shift register is uninitialized, the array should now contain the array of references from the previous call. But all references are closed. The values on the left of the probe watch window are still the addresses of the references, but on the right, they are 0!?

Basjong53_0-1684421139171.png

Probe [38] is on the shift register output, probe [39] is on the shift register input.

 

I want to store the references for later use and don't run the Find Devices.vi each time, as the nisyscfg\Find Hardware.vi takes a few seconds to run.

 

How can I make sure that the references are not closed when my VI finishes executing?

 

0 Kudos
Message 1 of 3
(940 Views)
Solution
Accepted by topic author Basjong53

What happens if you keep the toplevel caller running (I assume it is a state machine or similar) and then call the VI again.

Message 2 of 3
(935 Views)

Yep that was the problem 😑. I was too focused on testing the VI itself that I didn't test it in the designed use case. Thank you.

0 Kudos
Message 3 of 3
(926 Views)