07-23-2010 11:16 AM
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!
Solved! Go to Solution.
07-23-2010 01:51 PM
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/
07-23-2010 03:22 PM
I think your Simple Event Structure will work with a different mechanical action on the buttons, Latch When Pressed, even without a loop.
07-23-2010 03:38 PM
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.
07-23-2010 03:46 PM
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.
07-23-2010 03:53 PM - edited 07-23-2010 03:56 PM
No, don't use a sequence and multiple event structures!
Here's one possible alternative (simple draft).
07-24-2010 02:21 AM - edited 07-24-2010 02:25 AM
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.
07-24-2010 04:13 PM
Oh okay, I see. Thank you for your help!