03-22-2009 12:45 PM
Solved! Go to Solution.
03-22-2009 01:14 PM
Your stop button in tryOut2.vi is read only once at the beginning. To read it in every iteration of the while loop, it must be placed inside the while loop.
Use execution highliting (the light bulb icon), to watch how the program executes.
Felix
03-22-2009 05:48 PM
I also tried by moving the stop button of TryOut2.vi to inside its the while loop, but result is still the same. The TryOut1.vi is still read only the value only when it start. Is there any setting that I have to set ?
Thanks.
03-22-2009 06:26 PM
You have to rewrite the VI. You need to understand basic dataflow. When you have a subVI, you pass execution to it and nothing is passed again until the subVI finishes and returns to the main. Since you don't have any way to pass a stop condition to the subVI, you are stuck. You could simply make the front panel of the subVI visible and use it's top button. You could also create a reference to the main's stop button and pass that to the subVI. You would then use the reference in the subVI to control it's stopping. You could also use a global variable. Set it in the top level and read it in the subVI.
There are shipping examples and numerous posts related to this subject as it a subject that many beginning programmers have a problem understanding.
Your main has a big prblem as well with the stop button outside the loop. You can't do anything with it there either.
03-22-2009 06:49 PM