LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Two buttons in the same case of state machine architecture

Solved!
Go to solution

Hi everyone, now I'm learning about using a state machine for my project. I made 4 cases in my project, Init, Main, Clear, and Stop. Using "Select", when I click Stop button it will change the state into Stop case. Is it possible to use the same way with my Clear button? But I want to use these buttons inside the Main case. Please suggest me what should I do about this. Thank you.

 

image.png

 

0 Kudos
Message 1 of 5
(1,481 Views)
Solution
Accepted by topic author keyvdir

moderator1983_0-1594607192032.png

 

In this case, 'Stop' has higher priority than 'Clear', which means if both ('Clear' and 'Stop') are True, 'Stop' will be given preference.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


Message 2 of 5
(1,470 Views)

Wow! That's so much simpler. I was using OR condition and it worked also actually. But your solution is way better. Thanks!

0 Kudos
Message 3 of 5
(1,463 Views)

As a side note, I would suggest that you make your enum into a typedef. If you add a state later you don't want to have to track down all of these constants to change them.

Message 4 of 5
(1,387 Views)

@johntrich1971 wrote:

As a side note, I would suggest that you make your enum into a typedef. If you add a state later you don't want to have to track down all of these constants to change them.


Just to complete your thought:

You'll still have to track down all the constants to change them to replace all the regular enums with the typedef'd version, but this happens exactly once, and from then on you don't have to worry about manually updating them again.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 5 of 5
(1,354 Views)