LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with event structure calling code

I have a vi with two event structures however only one of them is running at a time. These are in loops in different states of a state machine. For some reason the second one being in the code is enough to lock up the first one. What could be the reason?

0 Kudos
Message 1 of 6
(2,656 Views)

Looks like there was a lock front panel checkbox under the events. My question now is whether there is a way to globally unlock all the events.

0 Kudos
Message 2 of 6
(2,645 Views)

I believe the answer is pretty clear in this Knowledge Base

-----

The best solution is the one you find it by yourself
0 Kudos
Message 3 of 6
(2,640 Views)

I assume that you have two Event structures in your State Machine because you want to respond to Control 1 in State 1, and to Control 2 in State 2.  The simple way to handle this is to set the Disabled property of the Controls that you do not want to trigger an Event in those States where you don't want them, and clear Disabled when you want to use them.  This way, you have a single Event loop with all of your Controls inside it, running in parallel with your State Machine, and only those Controls that are appropriate are able to generate Events (with the "appropriateness" controlled by the State Machine).  Simpler design, guaranteed to work.

 

Bob Schor

0 Kudos
Message 4 of 6
(2,611 Views)

@Steve_Block wrote:

I have a vi with two event structures however only one of them is running at a time. These are in loops in different states of a state machine. For some reason the second one being in the code is enough to lock up the first one. What could be the reason?


You need to attach your code, because a verbal description is insufficient.

 

Looks like your state machine is inside out with loops containing event structures inside states. This will not work. Remember that event structures queue up events even if they cannot execute due to dataflow constraints. Also, by default, events lock the front panel until the event completes. This cannot happen if the evet structure is not in the current code path and the code locks up forever. 

 

 

0 Kudos
Message 5 of 6
(2,600 Views)
The most efficient way of combining a state machine with events is to have the event structure on the outside and build the state machine in the timeout event. With this organization, if nothing is happening that the code needs to deal with, the state machine goes on its merry way doing whatever it needs to do.

But if an event does occur, the code can immediately respond, and then go right back to the state machine.

Mile...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 6
(2,548 Views)