Showing results for 
Search instead for 
Did you mean: 

How do we link multiple stop buttons to make one master stop button?

I am building a program that has multiple loops running simultaneously. How do I create a master stop button/link the multiple stop buttons to one? Right now I have 14 different stop buttons and would like to control them all with one main stop button, that way I won't have to hard stop the program, and for when we compile the program into a stand alone running program, the user will be able to have a master stop button available? Any help would be appreciated. Are there any available tutorials?

0 Kudos
Message 1 of 23

Creating local variable of the boolean should solve your issue.



Message Edited by Andy C. on 03-17-2010 12:01 PM
Andy Chang
National Instruments
LabVIEW Control Design and Simulation
0 Kudos
Message 2 of 23
You can replace all of the various stop buttons and use notifiers. When the user stops the application your master stop would fire a notification and all of the listeners woudl be notified they need to stop.

Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 3 of 23

You can use a local variable to do that, but remember, use local only if you have to.  For the switch, remember to change the mechanical action to switch until released.




Kudos and Accepted as Solution are welcome!
Message 4 of 23

You're better off using a notifier, as Mark suggested.  You are guaranteed not to have race conditions.  You can stop as many loops as you need to.  And, if you name the notifier, you can access it in subVIs too, which can come in very useful.


It looks like this.


stop notifier.PNG


This is a more flexible and reliable solution than a local variable.  I'd recommend you do it this way.

Message 5 of 23
As a modification of Diane's approach, I like to wire the error out from the Wait on Notification to the Stop terminal in the while loop, and move the release notifier so that it executes after the master loop stops.  Once the notifier is released, any function that is waiting on that notifier returns an error, causing the loop to stop.  This leaves you free to use the notifier data for something else.
Message 6 of 23
Diane, I have very little Labview experience, could you explain how the notifier works exactly?
0 Kudos
Message 7 of 23

Start with the LabVIEW help.  The folks who wrote the help files do a pretty good job of explaining things.  Read the help files for all of the notifier functions, then post back if you have specific questions and I'll do my best to answer them.  Also look at the notifier examples that ship with LabVIEW.





0 Kudos
Message 8 of 23

Does using the "Wait on Nofication" function here require similar (or even coupled) timing of the two loops?  If one were to use "Get Notifier Status" this would remove this limitation, correct?



0 Kudos
Message 9 of 23

@DGCH wrote:

Does using the "Wait on Nofication" function here require similar (or even coupled) timing of the two loops?  If one were to use "Get Notifier Status" this would remove this limitation, correct?

Not quite sure what you're asking here.  The two loops run completely independently.  Get Notifier Status returns the most recent message immediately, even if has already been seen.  Wait on Notification waits for a message that that particular node has not yet seen.  It has nothing to do with the timing.

0 Kudos
Message 10 of 23