LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with timer SUBVI

Solved!
Go to solution

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

0 Kudos
Message 1 of 6
(2,645 Views)

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

0 Kudos
Message 2 of 6
(2,635 Views)

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!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 6
(2,635 Views)

@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. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 6
(2,617 Views)
Solution
Accepted by topic author 77maxmustermann

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: 

NOtifier.PNG

Message 5 of 6
(2,603 Views)
Solution
Accepted by topic author 77maxmustermann

Here's one way with a notifier.

Capture.PNG

Message 6 of 6
(2,572 Views)