04-13-2015 08:25 AM
Hi all!
I'm building a VI which will run a number of subsequent tests. each test runs in turn inside a while loop until a certain condition is met, but I also want to be able to kill the operation with a single stop button at any time.
Currently I'm using a notifier and an additional loop for the stop button, but that method adds a lot of wiring to the VI, and makes it complicated to make separated subVI's from the tests.
Is there a cleaner way of doing what I'm trying to do?
a simplified version of the code is attached (instead of actually testing stuff I just made each loop count 10 iterations for the examples sake)
Thanks!
Solved! Go to Solution.
04-13-2015 08:34 AM - edited 04-13-2015 08:35 AM
Hi shayelk,
but that method adds a lot of wiring to the VI, and makes it complicated to make separated subVI's from the tests.
Once you use NAMED notifiers you can easily create separate subVIs…
- Less wiring: use a global variable…
- Less wiring: use a FGV aka AE to hold your STOP condition…
04-15-2015 01:32 PM
Thanks! I'll try it out...
One question though- what would be the best way to go about making the loops run one after the other? (as I know sequence structures are not recommended)
04-15-2015 01:42 PM
You could create a data dependency by passing the error cluster along from one loop to the next.
04-15-2015 10:43 PM
This is really the wrong architecture, overall highly flawed and overly complicated.
Just use a single loop and a state machine architecture and everything will fall in place.
Rethink the code from the ground up!
04-15-2015 11:30 PM
@altenbach wrote:
Just use a single loop and a state machine architecture and everything will fall in place.
Here's what I had in mind (LV8)