LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with state machine and event structure

I have a state machine that is controlled by button presses.  A single button causes a state change, but the state to move to depends on which state you're currently in.  In other words, if I'm in state X, pressing button A will move to state Y.  If I'm in state Y, pressing the same button A will move to state Z.

What is the easiest way to do this? I tried using an event structure for this but haven't been able to get it working.

Thanks!
0 Kudos
Message 1 of 4
(3,047 Views)
Using a state machine with an event structure is often a nice way to go !

If the next case depends on a combination of the previous and another event you can keep track of the previous case using a "dropped down shift register" see pics below 😉



Hope this helps

Message Edité par TiTou le 07-10-2006 02:24 PM


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 2 of 4
(3,043 Views)
Could you elaborate anymore on how to set this up?  You can't have an event handler in each state of the state machine...
0 Kudos
Message 3 of 4
(3,040 Views)
of course... a bit of code is worth a long speech, so have a look at the example attached. I just started from NI template "Standard State Machine" and added a case called "user Interface" in which I wait for an event and then see what was the previous event to decide where I shall go next 😉



We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 4 of 4
(3,029 Views)