ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple subsequent loops

Solved!
Go to solution

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!

Download All
0 Kudos
Message 1 of 6
(3,277 Views)
Solution
Accepted by shayelk

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…

 

Best regards,
GerdW


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

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)

0 Kudos
Message 3 of 6
(3,204 Views)

You could create a data dependency by passing the error cluster along from one loop to the next.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(3,194 Views)

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!

0 Kudos
Message 5 of 6
(3,168 Views)
Solution
Accepted by shayelk

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

 

 

Message 6 of 6
(3,157 Views)