01-03-2019 07:44 AM
Sup I have a timer SUBVI and it's running in a while loop so my question is: is there any way to stop it from outside of the subvi?
There is a simple examples in attached to this
Solved! Go to Solution.
01-03-2019 08:06 AM
The central concept of LabVIEW is the concept of Data Flow, namely that all of the data must be available to a Structure (such as a While Loop) before the Structure can begin to run, and none of the outputs are available unti the Structure exits.
Having said this (elementary, fundamental) concept, there are ways of working "around" the Principle of Data Flow to accomplish what you may be trying to do. I'm guessing that you are a LabVIEW "beginner" -- why don't you describe what you are really trying to accomplish, and we might be able to suggest another way of doing it. One way would be to "memorize" an Initial Time (the "clock" outside your While Loop), saving this in a variable "t0". Now you can easily measure "Elapsed Time" by doing another Time measurement and subtracting t0. The Clock is always running, but you don't need to monitor it.
Also, take a look at the Elapsed Time Express VI -- does it do what you need?
Bob Schor
01-03-2019 08:06 AM
Hi Max,
is there any way to stop it from outside of the subvi?
Short answer: No, you have to click that "boolesch" button. (Don't you find a better label for that button?)
Long answer:
Surely there are ways to stop the loop from outside the VI. You may use references to that button to set it's value…
Better idea is to get rid of that loop or to use other LabVIEW elements as notifiers, queues, even global variables!
01-03-2019 08:54 AM
@GerdW wrote:
Hi Max,
is there any way to stop it from outside of the subvi?
Short answer: No, you have to click that "boolesch" button. (Don't you find a better label for that button?)
Long answer:
Surely there are ways to stop the loop from outside the VI. You may use references to that button to set it's value…
Better idea is to get rid of that loop or to use other LabVIEW elements as notifiers, queues, even global variables!
Nonsense post...to put it in my list. I cannot see the code on my phone.
01-03-2019 11:07 AM - edited 01-03-2019 11:13 AM
You can always try to use a global variable which you change from your main vi.
The second option might be to put a dequeue element structure so that your subvi is always queuing to itself the timer case, and whenever you need to stop it your main vi can push an exit case in front of the queue.
Third option is to apply a similar concept to the queue. Put a second loop in your Timer.vi that just sits and waits on a notifier from your main vi.
I had a splash art vi that I was calling from my main Vi and had to abort from my main Vi and I used notifiers for that.
In your case it will look like this:
01-04-2019 11:19 AM
Here's one way with a notifier.