LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

code from 1 VI split up in different VI's

I'm developping a somewhat bigger project.
Until now all my code is in one VI...
Is it possible to split up my code from 1 VI in different VI's.
Now I have the import of textfiles, the communication with a device (gpib), the read from gpib, the calculations ... all in 1 VI.
It would be nice if it would be possible to have a mainVI now with a menubar (import, read, calculations, ...) so I can make different VI's
for the parts and invoke these from the menubar from the mainVI...
Is this possible and are there anywhere examples of this? Thx...
0 Kudos
Message 1 of 9
(3,055 Views)

You can automatically create subVIs from the code in your main VI by selecting the code you want and then going to the Edit menu and selecting Create SubVI. Depending on how clean your wiring is, you may or may not need to modify the terminals that LabVIEW chooses to assign to the various inputs and outputs.

For user menus, open the Example Finder and do a search for menus on the search tab.

Message 2 of 9
(3,035 Views)

You can select the code in your current VI and then select Edit>>Create SubVI from the menu bar. LabVIEW will create a new VI for you which you can save and use as a subVI.

You can also create a customized menu bar for your application. Refer to "Chapter 16 Customizing VIs >> Customizing Menus" section of the LabVIEW User Manual.

0 Kudos
Message 3 of 9
(3,033 Views)

Thx for your response... I already kwew about the subVI etc...
But what with front panel items?
Is it possible for exemple: you have a menu bar with 3 options: import, read and calculations.
With import there is a table and graph etc on the front panel,
with read there is gpib communication stuff on the front panel and
with calculations ther is another table and graph etc on the front panel.

So I want that when I invoke import from the menubar I see only the corresponding table and graph.
Afterwards if I invoke gpib, the table and graph has to disappear and the communication stuff has to be there in place... etc...

Is this possible ?

0 Kudos
Message 4 of 9
(3,017 Views)
It's pretty easy to do. You can put the various indicators in the subVIs and have them pop up when called. You can show/hide front panel indicators with property nodes, or you can put different indicators on different pages of a tab control.
0 Kudos
Message 5 of 9
(3,004 Views)
Can you please demonstrate this in the next VI because I don't know how to do.
I made a very easy VI which you can easily edit I think.
Thx again.
0 Kudos
Message 6 of 9
(2,996 Views)
I can't edit it at all since I don't have LabVIEW 8Smiley SadSave it as 7.1 and I'll take a look.
0 Kudos
Message 7 of 9
(2,990 Views)

Oh sorry, really thx for your time...
Here is the 7.1 version.

0 Kudos
Message 8 of 9
(2,979 Views)

Here's a quick example. I moved the controls/indicators to different pages of a tab control. In each case, I wrote to the tab control's local variable to set the right page. Of course, with a tab control, you don't need menu options to swithc between pages but if you want to hide the tabs, then using the menu will make more sense. There's other ways to do this. Another way would be in each case statement to make all of the unwanted controls/indicators invisible. This is done with property nodes.

You should also look at using the event structure. There is a shipping example that uses events to handle menu selections. The event structure is a more effecient method of programming than the polling method you have in this example.

0 Kudos
Message 9 of 9
(2,969 Views)