09-16-2016 02:12 PM
I am currently trying to set up my VI so that I can end the current iteration of a For loop if i choose to. My VI contains 2 event structures and several While loops. Right now I have an event in both event structures to stop them when a button is pressed. This works if I have not ended one or both of the event loops already but if I've already ended one of the event structures, it queues the stop event and executes it on the next iteration of the For loop. How do I prevent this from happening? If that is not possible, what is another way to program what I want to accomplish? Thank you!
09-16-2016 02:30 PM
Hi Levitan,
general rule: don't use more than one event structure per VI.
general rule: don't use the same event in several event structures.
(Unless you REALLY know what you are doing!)
Convert your VI into a real state machine - it will make your life (a lot) easier!
09-16-2016 02:53 PM - edited 09-16-2016 02:59 PM
OMG! Rube Goldberg much?
@GerdW wrote:Hi Levitan,
general rule: don't use more than one event structure per VI.
general rule: don't use the same event in several event structures.
(Unless you REALLY know what you are doing!)
Convert your VI into a real state machine - it will make your life (a lot) easier!
Listen to GerdW and most importantly Convert your VI into a real state machine!
Each "frame" of your flat sequence should be state in a state machine, except for your second frame (the one with three loops) that should be three or four separate states. Use shift registers to pass values from one state to the next, not a bunch of local variables..