Showing results for 
Search instead for 
Did you mean: 

Using Event Structure in an Enum State Machine

Go to solution


I am new to labview(~10 months). I tried my best to searched on the forum/net but did not get an explanation.
I simplify the code to demonstrate the problem. I'am using Labview 2013 ver 13.0f2 (32-bit).

The attached "" is an Enum state machine.
The "idle" state contains an event structure which detect value change evnet of 3 buttons:

Do something button:  just show somthing at the Display indicator
Start Running  button:  bring the program into "run" state
End                    button:  bring the program into "end" state and close it afterwards

The "run" state is a while loop, which will be stopped only by cliking the 4th button - Stop Running button and bring the program into "idle" case again.

The problem is at "run" state, any click on the irrelevent 3 buttons ( buttons only detected by event structure in "idle" case) will make program crash.
By comparision, I create another vi attached as "", which is almost same except the event structure is replaced by a while loop (and Do something button has no function). In this vi, everything works fine -- clicking on the irrelevent buttons won't crash.

I can't figure out why.


P.S. I failed at attaching .vi file onto this post... a compressed zip instead.

0 Kudos
Message 1 of 3
Accepted by MRChou

A problem that looks similar to yours :


I think the answer from Stuart will help you to understand how your code handles this situation.

You should handle your events outside of your main loop to let your structure run on any caught event.

CLAMaxime -- Kudos are a great way to say thank you
0 Kudos
Message 2 of 3



After reading the thread, I found that NI actually had created a page for noobs like me 🙂


Event structure just not works as the way I thought. I should  have read this...




Thanks again for responding!



0 Kudos
Message 3 of 3