09-29-2016 02:05 PM
I have a project where I am running 4 loops at the same time and need to stop all loops with one stop button and stop all loops if one of the loops gets an error.
Loop 1.
Start up loop
controlls the other 3 loops
Loop 2.
Read analog voltage
Loop 3.
Read Digital inputs
Loop 4.
Write Digital output
Any one know how to do this?
Solved! Go to Solution.
09-29-2016 02:15 PM
09-29-2016 03:16 PM
Many ways to stop parallel loops. I agree with Gerd, the best way is a notifier.
Here a useful document.
http://digital.ni.com/public.nsf/allkb/267704CDE91156D186256F6D00711AAE
Good luck
09-30-2016 08:34 AM
Two other methods not mentioned in the otherwise-excellent document Matt mentioned are use of a Global "Stop All" variable and a related use of a VIG/Functional Global Variable. The reason to mention them is that they can be used to additionally stop "detached" VIs, VIs that are set to run asynchronously (and thus somewhat "out of control") with respect to the main VI.
I'm using a "combination of ingredients" for some Projects I'm currently developing using LabVIEW 2016 and its support of Channels. For example, I use a Messenger Channel to create something analogous to a Queued Message Handler. When the Event Loop detects the Exit button has been pushed, it puts an "Exit" Message on the Messenger Channel and also stops itself. When the Message Loop sees "Exit", it sends an Exit Message on to whomever else needs to see it (in one case, the Producer of a Producer/Consumer pattern) and stops itself. When the Producer gets the Exit Message, it puts a "Last Element, Not Valid" on the Stream Channel to the Consumer, and stops itself. When the Consumer gets the Last Element message, it ends itself. A glorious cascade.
And I'm working out (not yet 100% complete) how to extend this to Start Asynchronous Calls, which don't (yet) support Channels as easily ...
Bob Schor
10-03-2016 01:06 AM - edited 10-03-2016 01:06 AM
Tnx for the information. I was looking at this too. I will test this out but will take some time to edit my codes and connect the loops. 🙂