LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie: Use a button to open channel config subVI

I am new to Labview (using 7.1) and want to rewrite one of my Visual Basic 6 applications using Labview to help me learn.

On the main form, there should be a command button that when clicked will open a channel configuration VI that allows users to open a .ini file and edit the channel names and scaling (slope and offset). When done the options are saved to file. When the main vi runs, it uses this config information for scaling and graph labelling.

I'd like to recreate this "click to open a subVI for config" functionality in Labview. Right now everything is on my main VI screen and boy is it messy.

Can someone tell me how to open a channel configuration VI from my main VI to allow the user to do some con
figuration before running the data acquisition that takes place in the main VI?

Thank You
0 Kudos
Message 1 of 5
(2,990 Views)
Your exact process is not exactly clear to me. I think that you want a wrapper vi to open at startup which just has buttons such as "Config", "Run", etc. Is this correct? If so, then this can be accomplished very simply. Use an event structure linked to each of your buttons. The event structure is inside a while loop. Make sure that you have a stop case in the event structure. Stop the while loop on either an error or the stop button activated. Otherwise continue waiting on events. Inside the event in the appropriate cases you will put your subvis. Make sure that the subvis are set to open the front panel when called and then to close when completed.

If my understanding of what you're trying to do please let me know.
0 Kudos
Message 2 of 5
(2,990 Views)
Hello �

A different approach to John�s suggestion is to use a queued state machine. If you use an event structure you can �miss� events if these happen while you are still executing a piece of the code due to a previous event. With the queued state machine you can set the stage you want to go next, and you don�t have to worry about missing events.

Take a look at the following links to learn more about state machines in LabVIEW:
Application Design Patterns: State Machines.
Using a Menu-Driven State Machine in LabVIEW.
p://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3DE6756A4E034080020E74861&p_nod....
Using a State Machine (Event Driven) Architecture.

A different architecture would be to use a sequence structure to make sure your program follows the order of execution that you want (Configure � Acquire � Analyze � Present).
This way you can guarantee that you will not go to Acquire before the Configuration has been done.

Hope this helps.

S Vences
Applications Engineer
National Instruments
0 Kudos
Message 3 of 5
(2,990 Views)
How can an event structure 'miss' an event? An event structure queues events so that it is impossible to miss an event or process them out of order (see attached presentation by Jason King). If this is not the case then I would like to know so that I can account for this in my own programming.

Thanks,

John
0 Kudos
Message 4 of 5
(2,990 Views)
Thanks to everyone. I like the state machine idea and will try to get it working from there.
0 Kudos
Message 5 of 5
(2,990 Views)