LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

An Event structure somehow prevents a Boolean control from being read during a While Loop.

I've attached a simplified VI that illustrates my Event Structure problem.
0 Kudos
Message 1 of 4
(2,690 Views)

Your program behaves exatcly how it should. The problem is that you have your event structure in the idle case. When a test is running, the event structure will not do anything. When you create an event, the default behavior is to lock the front panel until the code for that event finishes executing. Since your button 2 is handled in the event structure, if you press it while the test is running the front panel will lock, but the code will not run until after the 10 second test finishes, the state becomes idle, and your event structure executes. It then sees the button 2 event and runs the code for it.

The best way to implement what you want is to use one loop to handle your user events and another that contains your state machine to run the test. The 2 loops can then communicate with a queue to send start/stop commands. If you've never done something like this, search the examples for queues to see how to use them to run concurrent loops and pass data between them.

0 Kudos
Message 2 of 4
(2,679 Views)

If you look at the bottom of the Event Case editor dialog, you'll see a checkbox labeled "Lock Front Panel until the event case for this event completes".

This is what is preventing you from using the Start Test button. Even though your state diagram is in a state that does not contain the Event Structure, it will will still detect and queue events so that none are missed.

Unchecking this box for the "button 2" event will allow you to operate the Start Test button after hitting the "button 2". Note that the button 2 event now fires after you hit the Start Test again because it is in the event queue behind the Start Test event.

Ed



Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 3 of 4
(2,679 Views)
Got it. Thanks guys.
0 Kudos
Message 4 of 4
(2,673 Views)