02-07-2013 08:04 PM
I have a simple VI. I have loop 1 with and LED and a stop button and I have loop 2 with an LED and stop button. They are both in while loops. When I run the VI,if I stop loop 1, I can not turn it back on. If I stop loop 2, it will not stop. I've attached a file with my VI.
02-07-2013 08:47 PM
bebesbabe,
This looks like a learning exercise, so I will not present a complete solution.
1. It is not polite to post to the Forum a VI which will not stop except by pressing the Abort button. The Abort button should only be used to stop a VI if something is wrong with the program during development. Add a stop button to the outer loop.
2. A loop with no delay will try to run as fast as possible, consuming all the CPU resources it can get. Since these loops are for user interfaces, delays of 100 to 200 ms are appropriate. Use the Wait (ms) function.
3. Your main problem is understanding dataflow. In LabVIEW any node may execute only when all of its inputs have been given data and it will not complete its execution until all nodes inside it have completed. Your VI does not have external inputs so waiting for data is not a factor. Each loop is considered a node. So the outer loop will iterate only after BOTH of the inner loops have stopped. On the next iteration both inner loops will be started again. Of course if the stop buttons are still pressed, the will stop after one iteration, which will seem almost instantaneous. But because of dataflow as I have described, your program cannot really work the way you want. You cannot restart one loop until both have stopped. Put an indicator on the "i" terminal of the outer loop.
4. You may wish to consider changing the mechanical action on your stop buttons to Latch when Released. Read the help to learn about mechanical actions.
The way the instructions on the front panel read, it is not clear what the intended solution is. What control or user action or program action is required to turn the loops back on? Changing the stop button? Automatically after a delay? A separate On switch? How is the entire program supposed to stop?
Lynn
02-08-2013 08:19 AM
02-08-2013 09:39 PM
OK. It is good to start simple. Work through some of the things I suggested. When you get stuck again, post your latest VI and ask for more help.
Lynn
02-09-2013 05:25 AM
Can you please convert your vi to 2011 compatible.
If there is no connection between two loop. They will run independently by default
02-09-2013 07:42 AM
You might want to go through some of the on-line tutorials