LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering Ordered Commands in Using Event Structure

Solved!
Go to solution

I wrote a couple of weeks ago asking for help running programs using .NET. Finally figured out, (thank you) I am ready to move on. My goal is to control Filmetrics software through LV. In the attached vi the .NET configuration works and now I am just having trouble with the controls. To start a film measurement, Filmetrics takes a series of spectra of the sample, reference, and background, so I would like to do the same in LV. I think using an event structure in a sequence is what I should do, but any other ideas are welcome. I want the buttons only to be able to be triggered in order and disabled when it is not their turn. As of now, after I click "Acquire Baseline" the front panel freezes. Also attached is a very simple version of what I am thinking, and this one freezes as well. Any help would be great!

Download All
0 Kudos
Message 1 of 8
(3,065 Views)

You are not using an event structure correctly. Normally, an event structure is housed within a loop. When an event gets handled the loop will iterate and then go back to waiting for the next event. Please take a look at the examples that ship with LabVIEW. Open the Example Finder (Help -> Find Examples) and search for "events". Examples include "New Event Handler", "Event Tracking", "Menu Selection with Events".

 

There are also several KB articles:

http://zone.ni.com/devzone/cda/tut/p/id/3331

http://zone.ni.com/devzone/cda/tut/p/id/5785

http://search.ni.com/nisearch/app/main/p/bot/no/ap/tech/lang/en/pg/1/sn/catnav:ex/q/event%20structure%20labview/

 

0 Kudos
Message 2 of 8
(3,033 Views)

I think your Simple Event Structure will work with a different mechanical action on the buttons, Latch When Pressed, even without a loop.

0 Kudos
Message 3 of 8
(3,019 Views)

You are completely misunderstand event structures. Any event structure will queue up events, even if it is not in the dataflwo, so pressing any "later" event will lock the front panel, because that's how you have configured the events.

 

If the user actions (and thus events) must occur in a specific sequence, you need to program it like a wizard. Using a single [Next>] button, for example. Make a state indicator to show the operator what will occur next.

0 Kudos
Message 4 of 8
(3,010 Views)

Thank you. I ended up putting the events in a sequence, disabling ones I didn't want to be active, and changing the mechanical action and it's not locking up anymore. 

0 Kudos
Message 5 of 8
(3,000 Views)
Solution
Accepted by topic author echarpen

No, don't use a sequence and multiple event structures!

 

Here's one possible alternative (simple draft).

Message 6 of 8
(2,995 Views)

Totally agree with altenbach. This also would allow you to use a "stop" boolean registered in one more event case, which would allow a graceful exit at any given time the sequence. Also, if for some reason a step fails, you could repeat that step again if you changed the loop to a while loop (rather than a for loop) and introduced another Boolean control. State machines are typically the most basic and elegant solution to ordered processes, especially where the order of the process may follow a nonlinear or conditional path.

0 Kudos
Message 7 of 8
(2,974 Views)

Oh okay, I see. Thank you for your help!

0 Kudos
Message 8 of 8
(2,952 Views)