I have a running subVI (as a popup windows). Inside this subVI, I have a while loop that is going to exit once I read a string via serial COM port.
I was wondering if it is posible to change the value of the while's loop exit button from
out side this subVI. Until now I can stop this subVI, with a local variable, but this happens in the same subVI. What I want to know is if it can be done from outside the while loop/from another VI.
I've read control references, global variables but still haven't figure this out.
Could someone help me with this issue, please!!
Many thanks in advance!
Solved! Go to Solution.
If you want to use the global variable, then you have to write the True value to the global variable in the main VI.
How is the subVI configured? (e.g. modal, etc.)
From the picture, you are stalling the main VI while the subVI is running, so clearly we need more information on your code architecture. Pictures are not sufficient.
You need to spend some time thinking this through.
You're waiting for this to happen because the next bit of your main VI needs this input, most likely. This means you want the main VI to stall and wait for this string. If you don't, you want to move the logic for this to your main VI so you can more easily handle the exit.
If it's in a subVI, you're likely going to want to just include a timeout and let that be the determining factor. Otherwise, are you really gaining anything by allowing the main VI to iterate and check/change values while this VI is running in the background?
Look at a simple state machine. In the acquire string state (or whatever you call it), you'll either acquire a string or you won't. If you do, you go on to the process string state. If not, you go back to the acquire string state. If you want to be fancy, make it event driven. Go back to the event structure before the second acquire string state. If anything is changed, you can process that event.
Any of these are cleaner ways to solve the same problem you're running into.
Hi, thanks to all for you replies. I have manage to exit the subVI using "Strict Refnum boleean control". This example saved my day:
Thanks alot, and have a nice day! Later on I'll try to exit subVI using global variables and event driven case.