10-01-2013 08:24 AM
You are going to have problems with your event structures. You have two of them buried inside case structures. There events are set to Lock the Front Panel until the Event is complete. If you hit a button to trigger an event and the state machine isn't inside that state to handle the event, then you will lock up the front panel, and you won't be able to hit any other buttons that would allow you to get to that state that would handle the event.
10-01-2013 08:49 AM
yep I saw that but how can I avoid this problem? I need the event structure because I need a VI "interactive" on which the user can choice.
10-01-2013 08:53 AM
Have a single event structure that contains all the events in the top level inside the while loop. Then it can handle everything. If you need to have your VI step through different states without user interaction, then put a timeout on the event structure so that it will advance without the user hitting anything.
A simple alternative would be to uncheck the "Lock Front Panel" checkbox on all the event cases in each event structure. At least your code wouldn't lock up. But it isn't recommended because you are still capturing events that will be handled when the state machine finally gets to that event structure, and it will do actions that may no longer be appropriate, possibly even a long time after you hit the button. It would lead to unexpected behavior for the user of your program.
10-01-2013 09:06 AM
"If you need to have your VI step through different states without user interaction, then put a timeout on the event structure so that it will advance without the user hitting anything."
Could you make me an example? because this is what I was looking for but I don't know how to realize it. Thank you
10-01-2013 09:08 AM - edited 10-01-2013 09:11 AM
I don't have time to be creating examples.
Just put your event structure in while loop and get it out of the case structures. Wire a value into the timeout node to the upper left of the event structure, a smalll value, perhaps 100 for 100 milliseconds.
Search the forums for "event structure state machine" and you'll find numerous other threads with people trying to do the same sorts of things. Reviewing their code and the response might give you ideas.
10-01-2013 09:12 AM
You mean this one in the red box:
If so how can I establish how long it should stay in that state/wait?
10-01-2013 09:12 AM
Wire a value into it.
I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours
10-01-2013 09:20 AM
yep I have done it following the help.
This aspect of the event structure is something that I haven't understood very well until now. Thank you for your clarification
10-01-2013 10:27 AM
Only to complete my understanding... could you tell me where I can do this:
"A simple alternative would be to uncheck the "Lock Front Panel" checkbox on all the event cases in each event structure. At least your code wouldn't lock up. But it isn't recommended because you are still capturing events that will be handled when the state machine finally gets to that event structure, and it will do actions that may no longer be appropriate, possibly even a long time after you hit the button. It would lead to unexpected behavior for the user of your program."
10-01-2013 10:39 AM
Edit the events handled by the each of the event case in each event structure. Look for a checkbox near the bottom.