LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW event structure not completing event

Solved!
Go to solution

I have a project with a while loop that houses two event structures (two for better organisation). We have noticed with one event structure that listens to two buttons that during a single application session, we can only run the event once. The events are to load a config file or to save one and we can only do either option during a single application session. After some troubleshooting, we have found that the event structure is getting stuck on the event and not moving forward. We need this to be able to allow for multiple events during a single application session. I've provided a VI snippet of the main project for reference and use. We are still relatively new to LabVIEW, so any help is greatly appreciated.

0 Kudos
Message 1 of 12
(169 Views)

The event structure is probably misplaced. To allow for multiple events, it must be included into a loop.

You did'nt attach any snippet. Since I don't have LV2024, as many other people here, I would not be able to open it, only view as a picture.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 12
(161 Views)

The snippet didn't attach, here it is.

0 Kudos
Message 3 of 12
(157 Views)

I have both event structures inside a single while loop. 

The VI snippet has been sent, it didn't attach properly before and I missed it.

0 Kudos
Message 4 of 12
(151 Views)

Each structure blocks the execution flow until its event is fired. From this picture I don't see any reason to use two structures anyway.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 5 of 12
(146 Views)

Generally speaking, if you want to "go through" an event structure, wire a timeout constant to its Timeout terminal (upper left corner).

The timeout is in ms. If the structure doesn't receive an event trigger within the specified  timeout, it releases the execution flow.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 12
(130 Views)

We tried a timeout, it fired before anything happened but then never again. 

0 Kudos
Message 7 of 12
(125 Views)

It sounds like each event structure needs to be in its own loop in order to allow for another to fire again. I'll make the adjustment and see what happens.

0 Kudos
Message 8 of 12
(124 Views)
Solution
Accepted by topic author MroxVest

Event structures are like giant nodes that fire exactly once, be it a timeout or a button click or a user event or whatever. Same as any other VI- if you want it to fire twice, you'll need it in a loop.

 

If you have two event structures, BOTH must fire before you can move on.

 

Having two event structures in the same loop is almost always a bad idea, and is almost certainly NOT working the way you want it to. Either combine them or put them in separate loops. If you want to monitor multiple buttons, use separate frames in one event structure, not separate event structures.

Message 9 of 12
(113 Views)

I had wondered about that. It sounds like best practice is to just combine everything into one event structure inside the single while loop. I'll make that adjustment and see if that fixes the issue. 

 

You all have been MUCH more helpful than NI, the support tech I got just wasted my time.

0 Kudos
Message 10 of 12
(108 Views)