LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem with two event structures handling the same user event

Solved!
Go to solution

Hello,

 

I have two event structures handle the same user event(dynamic event), but meet a problem that I cannot understand.
If one event structure takes long time to handle the event (for example in the second loop of the attached example vi, waiting 5s in the case ),
the other event structure will repeatedtly handling the case (i.e., in the 3rd loop, the dialog "2nd event stopped" continuously pops out).

Thanks.

 

WT

LV2013sp1, Win10 64bit

0 Kudos
Message 1 of 4
(1,511 Views)
Solution
Accepted by topic author weitong

There are good reasons that multiple Event Structures, particularly handling the same Event, are "discouraged".  You can get yourself in "confusing" situations.

 

In the LabVIEW Help, under "Caveats and Recommendations when Using Events in LabVIEW, Caveat #11 reads

  • Avoid using multiple Event structures in the same VI.

You not only have multiple Event structures in the same VI, you have multiple Event structures responding to the same "Event" (changing the Stop control) as "separate Events", a Value Changed and a User Event.

 

I also notice you have the Event Loops responding to TimeOut events frequently (at 100 and 200 Hz), but doing nothing!  If I'm not using the TimeOut Event, I don't wire the TimeOut Node.  So I unwired the TimeOut Nodes and "magically" fixed your program -- it no longer hangs!

 

Bottom line -- avoid using multiple Event structures in the same VI.  ("Avoid" does not necessarily mean "Never do this", but rather "Do this at your own risk -- you better have a good and clear reason for it ...").

 

Bob Schor

0 Kudos
Message 2 of 4
(1,487 Views)

Thanks, Bob.

 

WT

0 Kudos
Message 3 of 4
(1,482 Views)

As in LV2013 help

I find under "Caveats and Recommendations when Using Events in LabVIEW"

instead of

  • Avoid using multiple Event structures in the same VI.

And also, in my real application, the time out case is useful for handling regular jobs.

 

Best,

WT

 

0 Kudos
Message 4 of 4
(1,472 Views)