From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Executing SubVIs

Hi,
I wonder if anyone can help? I'm trying to put together a simulator
which contains a top level VI which acts as an options screen with options
to select. When an option is selected I want the corresponding subVI to
open in run mode. In each of the subVIs that open I want to have a button
which when pressed stops execution and closes the subVI and returns to top
level options VI. I've so far tried using a combination of the VI set-up
options for the subVI to Open when Called, and Close if originally closed,
along with the "opening VI References" to the VI, using a property node in
the main menu VI to make its panel Visible or not.
The results I have achieved so far is that I can select an option and it
will open the subVI,
but not in run mode. How do I get it to do this. I've
tried using the execute when opened option on the property node but don't
think I'm doing it right. I can only manage to open the subVI in run mode
when I open it separately on its own due to the settings in the VI set-up
options, but not from the options VI. With regards to the return to options
VI button, at present this stops subVI execution, but I'm having trouble
linking this with the options screen so that it closes the subVI down.
Does anyone have an example VI that shows how to link VI's in this sort
of way? Any help would be greatly appreciated.

Regards,
Martin.

PS. In the online help there is a VI called "Open VI", but I cannot find
this anywhere in the Labview library?
0 Kudos
Message 1 of 4
(2,688 Views)
You should try to open a Vi reference then use a "property node" and Choose
"Front Panel Window>>Open" change it to "Write" and wire a True constant
(This is the way to make "Show Front panel when called" using Vi server
features)
You will now need to use an "Invoke node" and select the "Run" method.
Wire a True constant on the "Wait Until done" input.

Hope this helps

Gerald
0 Kudos
Message 2 of 4
(2,688 Views)
Gerald,
Thanks for your help. I've got the open VI reference, property node,
invoke node and close VI reference inside a case structure on the diagram in
the top level VI and have got them to open (property node) and run (invoke
node) a subVI when I press a button. The simple subVI I am running has a
while loop which is ended by the press of a button in the subVI, this stops
the subVI execution. At this stage I would have thought the subVI would
have been closed by the top level VI since it had ceased execution, but it
doesn't. Do you know how I can get the subVI to close and go back to the
top level VI at the press of a button on the subVI which stops its
execution? Any help would be greatly appreciated.

Regards,
Martin.

"Gerald ALBERTINI
" wrote in message
news:386529f4@newsgroups.ni.com...
>
> You should try to open a Vi reference then use a "property node" and
Choose
> "Front Panel Window>>Open" change it to "Write" and wire a True constant
> (This is the way to make "Show Front panel when called" using Vi server
> features)
> You will now need to use an "Invoke node" and select the "Run" method.
> Wire a True constant on the "Wait Until done" input.
>
> Hope this helps
>
> Gerald
0 Kudos
Message 3 of 4
(2,688 Views)
Martin,

To implement the equivalent of "Close afterwards if originally closed" with
VI Server, you just have to use a second "property node" and Choose>> "Front
Panel Window>>Open" change it to "Write" and wire a FALSE constant on this
input.
That's why the "wait Until Done" option is useful, it will allow you to programmatically
close the SubVi after it completes its execution

I couldn't send you a sample because I have a problem with my internet connection
at home.
I will try to send you a sample tomorrow from the office.

Regards

Gerald


>Gerald,> Thanks for your help. I've got the open VI reference, property
node,>invoke node and close VI reference inside a case structure on the diagram
in>the top level VI and have got them to open (
property node) and run (invoke>node)
a subVI when I press a button. The simple subVI I am running has a>while
loop which is ended by the press of a button in the subVI, this stops>the
subVI execution. At this stage I would have thought the subVI would>have
been closed by the top level VI since it had ceased execution, but it>doesn't.
Do you know how I can get the subVI to close and go back to the>top level
VI at the press of a button on the subVI which stops its>execution? Any
help would be greatly appreciated.>>Regards,> Martin.>>"Gerald ALBERTINI"
wrote in message>news:386529f4@newsgroups.ni.com...>>>> You should try to
open a Vi reference then use a "property node" and>Choose>> "Front Panel
Window>>Open" change it to "Write" and wire a True constant>> (This is the
way to make "Show Front panel when called" using Vi server>> features)>>
You will now need to use an "Invoke node" and select the "Run" method.>>
Wire a True constant on the "Wait Until done" input.>>>> Hope
this helps>>>>
Gerald>>
0 Kudos
Message 4 of 4
(2,688 Views)