Tesla Posted Monday at 02:45 PM Report Posted Monday at 02:45 PM My Main.vi inserts VIs into a subpanel and runs them. In the first VI that is run in that subpanel a Diagnostic Connection is created, the session ref is written to a global variable. In the second VI that is run in that subpanel the session ref is read from global variable and used. The reference handle or whatever is used internally seems to be lost when the first VI that creates it finishes. I get an error -8000 "Handle passed to the function is not valid" in the "sub.vi". I can pass other classes like ModbusTCPMaster without any problems with this method. Any ideas? Quote
hooovahh Posted Monday at 08:02 PM Report Posted Monday at 08:02 PM This sounds like the expected behavior of LabVIEW. Many references go idle and the automatic garbage collector takes care of it, if the VI that made the reference goes idle. I'd suggest redesigning your software to handle this in a different way. Like maybe initializing the interface in a VI that doesn't go idle. Quote
Tesla Posted Tuesday at 12:18 PM Author Report Posted Tuesday at 12:18 PM Thanks for your input. I will probably keep the "create" VI running (wait until done=false) and implement more functions like reconnection on error, tester present and others. As long as that VI does not finish, everything works fine. Quote
ShaunR Posted Tuesday at 05:32 PM Report Posted Tuesday at 05:32 PM 21 hours ago, hooovahh said: and the automatic garbage collector takes care of it There is no automatic garbage collector. It's an AQ meme that he used to rage about it. Quote
hooovahh Posted Tuesday at 06:32 PM Report Posted Tuesday at 06:32 PM Well regardless of the reason, what I was trying to say is that references opened in a VI, get closed when the VI that opens them goes idle. 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.