06-26-2014 07:45 AM
Hello,
I have a while loop which I want to exit by a stop on the front panel.
Here is bit of code:
As you can see the code in the while loop is processed by completing four sub .vi.
I have found that if I press the stop button at a point when computing any of the 4 sub .vis then the while loop will make another pass and not exit at the end of the computation of the 4 sub .vis.
What is the way around this please? I realise that using stops on the front panel is not advisable!!!!
Thanks,
Daniel
Solved! Go to Solution.
06-26-2014 07:47 AM
Hi nevica,
you need to THINK DATAFLOW!
When you press the STOP button while the loop is executing the 4 subVIs it needs (most probably) another iteration to read that button once again!
Solution:
Read the button after your subVIs has been called. Use a (flat) sequence to do so…
06-26-2014 08:02 AM - edited 06-26-2014 08:07 AM
Yes, I am sorry. I understand what you mean regarding the timing of the loop and when the stop is read. But the stop in the while loop has to stay in the while loop. It cannot be put in a flat structure so thet the stp is read afterwards.
If I create a flat sequence (with two sequences) and the final sequence having a stop, How do repeat a flat sequence without using a while loop?
I could use a case structure. Case 1 being the while loop (so that it repeats and Case 2 empty. the question remains when is the case selector read for the case structure?
Daniel
06-26-2014 08:10 AM - edited 06-26-2014 08:13 AM
The flat sequence structure goes inside the while loop.
Case structure would work fine in this case, also. I like that solution better.
06-26-2014 08:13 AM
Done
06-26-2014 08:15 AM
Put something like this...
... here
06-27-2014 05:16 AM
Hi nevica,
the posts before your own solutions post, states the same. IMHO, it is more fair to give one of them the "medal of solution".