10-28-2015 04:10 AM - edited 10-28-2015 04:21 AM
I know this has a really easy solution but I can't seem to find it.
I have two event cases in a while loop. I have worked previously with one event case therefore I placed the stopped button inside the event case. However if I have 2 event cases I cant place the stop button in one of them so how can I stop the program then?
If the stop button is outside the cases the program wont stop.
Here's my vi that consists of adding two different values to one output depending on which button is pressed
Solved! Go to Solution.
10-28-2015 05:07 AM
Just add a case for the stop button.
Wire a Boolean constrant set to true out of the case to the while loop stop. In all other ceses wire a false.
10-28-2015 05:11 AM
as attached 🙂
10-28-2015 05:31 AM
Add one more value change event case for stop button and wire to while loop conditional terminal.
find the attached VI
Regards,
S Nagaraju
10-28-2015 05:43 AM
The solution suggested by "Sonti_11532" is ideal.
Also a alternate method is to simply connect a small constant value (like 10) to the TimeOut Terminal of the Event Structure in the VI posted by you ("patomated').
How it will work is, the event structure will Time Out after that fixed interval. When it Times Out it will check the value of the stop button and then accordingly proceed for the next iteration or stop the loop.
Caution : i suggest this only considering there is no other code written in the while loop.
Regards.
Digant Shetty (LV 18.0)
AE, Combined Digilog Systems Pvt. Ltd.
10-28-2015 07:14 AM
As an alternative, instead of even having a stop button, you could use the <This VI>->Panel Close event to stop your VI when the user closes the front panel (typically using the X in the top right corner of the window).