LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Nested event structures

I am developing a GUI that will allow a user to take data from our system, save it to a file and then do an analysis of the data all in the same program. Currently I have developed all my sub vi's and have placed them all in the right places but found that one of my sub vi's gets stuck. I believe it is due to the fact that there is an event structure inside a sub vi that is in another event structure. I am attaching my project as well as a sample file that would normaly be read it to analyze. On the front panel when the analyze is pushed the sensor number becomes visible and I want the graphs to update as the sensor number is changed. I tried vi alone and it works fine but when it gets added into the bigger program in causes the program to get stuck in that event. You can run the Single FFT.vi alone and see what it does if you want just choose the data file that I have attached as the file to read in.

The top level program is called BARCIII_DEV3.vi and the trouble vi is called Single FFT.vi.

So now to my question. Can I use a nested event structure or does anyone else have a better way of accomplishing the task of updating the graph as the sensor number is changed?

Thank you ahead of time,

Matt Kniller
Nova Research
202-404-2824
0 Kudos
Message 1 of 3
(2,736 Views)
Salutations,

When executing event structures, they will execute until they are complete. This is the same with subvi's, hence, when you're using a while loop in your sub vi, it won't be complete until you tell it to stop. So, the data it accumulates won't be passed on until the loop is finished. It seems, one way to avoid your problem is to exclude making it into a subvi. Granted, you'll have a while loop inside your event structure, but that isn't necessary the most ungodly thing ever invented. You could make an event in your main vi to handle the change in the channel number, or whatever it was you desired. That way it would run that subvi, getting the necessary information, and then updating the plots.

I hope this helps, if it doesn't, yell at me and I'll try to be more clear.

Sincerely,
ElSmitho
0 Kudos
Message 2 of 3
(2,725 Views)
In general, it's not a good idea to use multiple Event Structures in an application, though it can be done if carefully coded. Search the LabVIEW help for “Caveats and Recommendations when Using Events in LabVIEW” and you’ll find some good tips.

I think the way you have it have it setup (one in the top level and one in a subVI) is not a terrible thing to do, but again you should be careful.

One problem you could be having is the Event Structure in your top level is locking the front panel controls whenever an event is fired. Right click on the top level event structure and select "Edit Events.....". At the bottom of the dialog, there is a checkbox that reads "Lock Front Panel until the event case for this event completes". With this checked, all front panel objects are locked until the event completes. Try unchecking this and see if that makes your subVI work.

There’s another pretty good thread in the forum that discusses using multiple event structures. Have a read through it for some more pointers.

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 3
(2,705 Views)