LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Two Event Structure Loops: One Hangs

Solved!
Go to solution

Hello,

I have a wired problem when I try to use two loops with two event structures (see attached VI).

The problem is that one can stop the measurement and close the VI with X but not to only stop it with STOP button: this would lock the front panel.

 

Here my (bit lengthy and perhaps not perfectly understandable) description of the VI:

 

One structure should react on UI and the other does some certain action. The first only uses user events: START button value change, PANEL CLOSE? and STATE  enum value change. The second event structure uses dynamically registered ones: start user event & close user event.The action when the STATE button changes should always be performed. When START is pressed the start user event disables the START buton and activates a loop in the second structure which should do a continuous measurement. Now one can still change the STATE button and get some information (this works). The measurement loop should stop if the STOP button is true. Afterwards START is activated again and one should be able to press START again. This does not work as the front panel is locked. Strangely enough the last implemented user action works fine: pressing X of the VI, the PANEL CLOSE? is called in the first loop and should stop both loops: if the measurement loop is running, STOP is set True first, stopping the measurement loop. Then a sub-event structure waits till STOP is set to False again. If the measurement is not running the first loop just stops. In both cases the close user event is sent to the second loop, successfully stopping it.

 

I am really confused because I have no idea what is wrong. I would greatly appreciate any help on this.

Best regards,

Daniel

0 Kudos
Message 1 of 6
(2,780 Views)
The problem is the 3rd event structure in your “Panel Close?” event. It is not active so your front panel is locked out. Remove it and see how your code behaves differently. I’m not sure to say it runs correctly. I think you should have only ONE event structure and use a Notifier to start and stop the upper loop
Omar
0 Kudos
Message 2 of 6
(2,757 Views)

It is a bad idea to have event structures inside of event structures.  It is sitting there capturing events, but can't execute until the event that it is inside of occurs.

 

The thing that makes your situation doubly bad and what is causing the front panel to lock is that you have the "Lock Front Panel until this Event Case completes" checked for that inner event structure.

 

As Omar says, using a notifier might be a better way to go.

0 Kudos
Message 3 of 6
(2,747 Views)
Solution
Accepted by topic author Daniel R

Thank you very much! This solved the problem. I didn't understand that event structures queue the events even if they are not "active".

 

(Finally one does not even need a notifier, one can just change the value of the STOP button true and fire the close user event, comapare attached, working VI)

 

Thanks again,

Daniel

 

 

0 Kudos
Message 4 of 6
(2,730 Views)
I still like using only one event structure with a notifier. I'm not to sure what you are doing with the panel close event. It discards the panel close event but then stops the program.
Omar
0 Kudos
Message 5 of 6
(2,722 Views)
I tried to attachment the VI with only one event structure, but I did not take. I have been getting error from the rorums web site today.
Omar
0 Kudos
Message 6 of 6
(2,718 Views)