LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple event structures

Hi,
I am designing a large application. The architecure I am using is a state machine, whose transistions are dependant upon user input. The state machine is implemented using the normal idiom (a case-statment inside of a while-loop with an enumeration shift-register to keep track of the current state). To deal with user events I placed an event structure inside of each state that transitioned on user input. However, this does not appear to work. Sometimes my application locks up and other times it recieves an event more than once. I don't understand this because only one event structure is active at a time. I didn't see anything applicable in the event caveats page. I have posted a small samlpe VI that demonstrates the VI locking up
. I am still working on reproducing the multiple event error. Any ideas?
Download All
0 Kudos
Message 1 of 3
(3,313 Views)
Multiple event structures can cause lots of trouble. In your case, I recommend using a single event structure to capture your front panel events. You can leave your simple state machine structure alone and put the event structure in a "wait" case, or get fancy and use a queued state machine. I like the queued state machine approach for large applications since I can command a VI to execute a particular state from within a subVI or asyncronous top-level VI. With the queued state machine, I like to place the event structure in its own while loop with the queue reference wired in to it. When a particular event fires, the event case can put a state on the queue.

Since you are diving in to a large application, it may be well worth your while to hire an Allian
ce Member to help you for a few days. We can get you started on the correct path very quickly and you will have some solid code to which you can refer.

We do this stuff every day.

Daniel L. Press
PrimeTest Corp.
www.primetest.com
0 Kudos
Message 2 of 3
(3,313 Views)
PhotonDan is right on the money about using a single event. The problem is that in LabVIEW 6.1 there are only static events that are registered when the VI is set to run. Because of this, all events on your VI will fire when the value is changed and if the dataflow is not at the proper place when this occurs, yoru program will hang.

LabVIEW 7 offers a way to dynamically register events. This is often the only way to handle multiple events in the same VI. I do not think you will find this solution particularly helpful because a better solution is to just use one event structure.
0 Kudos
Message 3 of 3
(3,313 Views)