11-19-2010 11:31 AM
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
Solved! Go to Solution.
11-19-2010 01:21 PM
11-19-2010 01:47 PM
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.
11-19-2010 03:06 PM
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
11-19-2010 03:42 PM
11-19-2010 03:46 PM