11-09-2014 01:30 PM
11-09-2014 02:00 PM
Dear
Please Find the attachment bellow.
11-09-2014 02:03 PM
Dear
Please Find the attachment below:
11-09-2014 03:22 PM
It is not considered polite to post VIs with infinite loops without warning that the vi will not stop on its own. "The use of the Abort button to stop a VI is like using a tree to stop a car. It works but there may be undesired consequences."
To elaborate on the suggestion by Yamaeda the reason your Menu.vi pauses (it does not stop) while the subVI is running is basic dataflow. The fundamental concept of dataflow is that any node can begin running when all of its inputs have data and that a running node cannot complete execution until all code inside the node have completed.
For your code the relevant nodes are the outer while loop of Main.vi, the case structure wired to the boolean global, and subvi.vi. Each iteration of a node consisting of a while loop completes only after all code inside the loop completes execution. When Boolean is False, the case structure executes in a few nanoseconds and the sequence structure takes 200 ms (plus a few nanoseconds). So the loop runs at about 5 iterations per second. When settings is pressed, Boolean is set to True. The Boolean global Read which controls subvi.vi probably is read before the Write globals controlled by Settings was written. This is called a race condtion and is one reason local and global variables shoudl not be used as you have done here. On the next iteration subvi.vi is called. The case structure which contains the subvi.vi icon cannot complete its execution until subvi.vi completes its execution. This pauses Menu.vi.
To fix this you can use asynchronous calls as Yamaeda mentioned or the subvi could be called in the consumer loop of a Producer/Consumer architecture.
This program can be done without local variables, without global variables, and without sequence structures. All of those are rarely needed in well-written LabVIEW code and are not appropriate here.
Lynn