LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to call sub-vis with a click of a button?

Is there any block that functions llike "System Exec" ?

"System Exec" calls only .exe file.

I need a block that can call a Sub-VI.

 

TQ

0 Kudos
Message 1 of 12
(4,038 Views)
Check out the Call By Reference Node.
0 Kudos
Message 2 of 12
(4,027 Views)

A simple polling loop can do this.

 

CallSubvi1.png

 

So can an event structure:

 

CallSubvi2.png

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 12
(4,014 Views)

Attached are 2 test VIs.

Program3 is the main VI which calls Dialog.

 

The programm should work as described:

When Enum = wait, nothing happens.

When Enum = Show Dialog, the Dialog.vi will be executed and display the random generated value. Enum's value will then change back to "Wait".

I can then close the dialog.vi and reopen it again by selecting "Show Dialog"

 

Basically, i need to call the Sub-VI and it must run independently from the Main-VI.

 

Thank you.

0 Kudos
Message 4 of 12
(4,003 Views)
oops, here are the 2 VIs.
Download All
0 Kudos
Message 5 of 12
(3,996 Views)

Check out this thread.  There is an example of code that launches a specific vi (from a list) and waits for the vi to complete.  When the launched vi finishes control is returned to the main vi

 

Is that something like what you want ?

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 12
(3,984 Views)

not really.  for my case, the subVI should act like a pop up screen, and run continuously until i close it. And can be call out again when i need it.

in my previous program, my sub Vi is being called and close continuously.

0 Kudos
Message 7 of 12
(3,975 Views)

Hallo tbob,

 

i tried using the 1st example that u show me (the one with the case structure). but it doesnt solve my problem, because when i close the sub Vi, i want my main program to continue running. Is that anyway, that when i call the SubVi out and it will run independently as long as my main program is running?

0 Kudos
Message 8 of 12
(3,971 Views)

fmpfmpf wrote:

Hallo tbob,

 

i tried using the 1st example that u show me (the one with the case structure). but it doesnt solve my problem, because when i close the sub Vi, i want my main program to continue running. Is that anyway, that when i call the SubVi out and it will run independently as long as my main program is running?


 

You need to mention these things if you want a correct solution.  Here is a corrected version of your Program3 vi.  You don't really need an enum.  You could use a simple boolean switch set to Switch When Released.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 12
(3,950 Views)

Here is a way to do it with the example I first showed.  I don't know why you could not get it to work, it does.  I changed your diaglog vi to have a stop button to close its window.  Closing the subvi does NOT close the main.

 

 

Message Edited by tbob on 05-18-2010 04:46 PM
- tbob

Inventor of the WORM Global
Download All
0 Kudos
Message 10 of 12
(3,945 Views)