LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Report Error Visa

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.

 

Caveats and Recommendations when Using Events in LabVIEW.

0 Kudos
Message 11 of 20
(645 Views)

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.

0 Kudos
Message 12 of 20
(643 Views)

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.

0 Kudos
Message 13 of 20
(641 Views)

"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

0 Kudos
Message 14 of 20
(635 Views)

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.

 

0 Kudos
Message 15 of 20
(631 Views)

You mean this one in the red box:

 

Immagine.PNG

If so how can I establish how long it should stay in that state/wait?

 

0 Kudos
Message 16 of 20
(627 Views)

Wire a value into it.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 17 of 20
(624 Views)

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

0 Kudos
Message 18 of 20
(622 Views)

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."

0 Kudos
Message 19 of 20
(614 Views)

Edit the events handled by the each of the event case in each event structure.  Look for a checkbox near the bottom.

0 Kudos
Message 20 of 20
(608 Views)