LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While Loop problems

I am having trouble with loops. Can anyone please help me? Here is my problem: In the vi that I attached, I have two case structures running within a while loop. I want to have only one button that will turn on/off the indicator no matter what loop the application is running under. Also, is there a way where LabVIEW will stop the entire program by pressing the stop button of the overall loop if the application is running under a case structure instead of having to break out of the inner while loop and then pressing the stop button of the outer loop. I created this simple vi just to show what the problems that I am having.
0 Kudos
Message 1 of 7
(3,538 Views)

The answers are yes. The simplest solution would be to use a local variable, but this can be dangerous (race conditions), confusing (breaking the dataflow) and hard to follow (in large applications).
The basic solution would be to use a loop with an event structure for user input, and to control it from there.
To stop the loop, you can replace the stop button with an OR or AND operator and wire into it the values of the stop buttons coming out of the cases. When you stop a loop, the value will get to the operator.
In general, I suggest you read the LabVIEW user manual. Also, try searching this site and google for LabVIEW tutorials. Here is one you can start with. You can also contact your local NI office and join one of their courses. In addition, you should read The LV style guide and search the site for event structure tutorials.


___________________
Try to take over the world!
Message 2 of 7
(3,529 Views)
Thanks for the help, tst
0 Kudos
Message 3 of 7
(3,527 Views)
Actually, in this case a local variable is not dangerous. There won't be any race conditions occuring here. I have modified the vi to use only one stop button to get out of any loop and end the program. The only thing is that the mechanical action of the stop button had to be changed to a non-latch because of the local variable. That is why there is the resetting to false after the main loop.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 7
(3,509 Views)
I only have LabView 7.0, so I cannot view the file. Can please you back save it to Labview 7.0 or show me a screenshot of the vi? Thanks
0 Kudos
Message 5 of 7
(3,487 Views)
correction : I only have LabView 7.0, so I cannot view the file. Can you please back save it to Labview 7.0 or show me a screenshot of the vi? Thanks
0 Kudos
Message 6 of 7
(3,487 Views)
Here it is in 7.0
- tbob

Inventor of the WORM Global
0 Kudos
Message 7 of 7
(3,464 Views)