LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling VI on n-th Loop Iteration

Solved!
Go to solution

Hello all,

 

I have an VI (let's call this VI1) looking something like the one below.  How do I get it to call/run another VI (let's call it VI2) when i = 2.  I can't put VI2 in the loop because VI2 shall be run independently, and VI1 loop should not be waiting for VI2.  Thanks.

 

 

 

 

0 Kudos
Message 1 of 6
(3,402 Views)

Well, in this example, the loop spins millions of times/second and you won't be able to tell if the other VI starts right away or ant the third iteration. You might as well start both at the same time. In addition, your loop just repeats the same calculations over and over again for no reason. Isn't once enough??? 😮

 

OK, seriously now, you have may possibilities:

 

For all these cases, place a case structure on your loop, wire the selector to [i], and make one case  "2" and the other the default. Leave the default case empty and place your VI start code on the "2" case.

 

  • Launch the other VI using a VI reference and an invoke node. (set it to "don't wait until done" ).
  • Place the other VI in an event structure in a parallel loop and fire it with a value(sgnl) property in the case structure.
  • Use a queue.
  • Use a notifier.
  • ...
  • ...

 

See how far you get. 🙂

Message Edited by altenbach on 11-25-2008 09:14 PM
Message 2 of 6
(3,386 Views)

You'll have to call the SubVI dynamically.  I think these two VI's will illustrate what you want.

 

 

Message Edited by SiegeX on 11-25-2008 11:11 PM

Download All
Message 3 of 6
(3,385 Views)
Solution
Accepted by Bladhart

Using the integer  for the case selector is slightly more lightweight. 😉

 

 

Message Edited by altenbach on 11-25-2008 09:24 PM
Message 4 of 6
(3,379 Views)
great suggestion.  BTW, what program are you using to create your spiffy images? I think I saw you make an animated GIF too.  I'm guessing its not CCT or some other LabVIEW tool, or is it?

0 Kudos
Message 5 of 6
(3,376 Views)

Thanks.  It works now.

 

For all those questions you had:  the real VI isn't exactly like what I posted (it was a bit too big).  The VI actually only loops every 10 sec, and in each loop the values are different.

 

Thanks again for the help.

0 Kudos
Message 6 of 6
(3,348 Views)