Reputation: 5294
I'm trying to do something very simple:
I just want to be able to keep the loop running and the OK button working at the same time, how can achieve that simple task in Labview "way of life".
Results:
Upvotes: 0
Views: 1760
Reputation: 2669
Here is how you can do it with a Master/Slave configuration. All the user events are handled in the master, the counting is handled in the slave. The loop can be restarted and the stop works for both loops.
To Stop the code you use a different event, in the case the loop conditional is false you don't do anything in the slave loop. Not shown here, but the loop conditional also has it's own event structure to reset the counter if needed.
This master/slave structure is extendable to as many loops as you want.
Upvotes: 1
Reputation: 2669
I think the design pattern you are looking for is the Producer/Consumer pattern. This allows you to run parallel loops and if need be share data between them.
A quick google on the term combined with labview will give you enough examples.
Upvotes: 0
Reputation: 1893
I see two options:
Upvotes: 0
Reputation: 3105
You can't. You'll need two seperate while loops, one with the count functionality, but don't use the 'loop' variable as the stop condition, make the loop variable control a the count condition. In the other while loop you'll have your event code. The only thing you'll have to worry about is stopping the first while loop from the event code.
Upvotes: 2