LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

nested vi loop

Solved!
Go to solution

Dear all,

 

I have a main VI which calls another VI which consist of a while loop and a indicator which show the number of iteration. How do I display the iteration as it increments on my main vi, as I am seeing that it only display the number which the while loop ends. Attached is my VIs, someone please guide me. Thanks a lot.

 

 

Download All
0 Kudos
Message 1 of 7
(3,801 Views)

There are plenty of solutions and it really depends how th rest of the code looks like.

 

For example you could give a reference to an indicator on the main VI to the subVI and the update it from within the subVI via a value poperty node.

 

  • Did you notice that your VI uses 100% of a CPU core when not doing anything, spinning as fast as the CPU allows?
  • What posessed you to change the mechanical action of the OK button to "latch until released"? That is a very unusual mode.
  • Shouldn't that loop in the subVI be a FOR loop? You know the number of iteration before the loop even starts.
0 Kudos
Message 2 of 7
(3,787 Views)

You could use Queues, User Events, Notifers, or Global Variables to pass the data up to your main VI.  This will require that your subVI runs in parallel to everything else in your main VI.  I am partial to the User Events route.  Another option is to use a subpanel that you can load your subVI's front panel into to show the indicator.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 7
(3,786 Views)
Solution
Accepted by topic author xsychox
0 Kudos
Message 4 of 7
(3,770 Views)

Now that I have had a quick look at your code...

That subVI should use a FOR loop since you know how many times it will run.  And with that knowledge, you could use a progress bar on the subVI and have the subVI pop up when it start running.  If you set the progress bar's maximum to be the number of iterations you will have of your loop, it will be a since graphic of the progress of your test.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 7
(3,757 Views)

@altenbach wrote:

There are plenty of solutions and it really depends how th rest of the code looks like.


As I said, we really need more information about the full code design.

 

What else is there? (currently, th code is so sparse that the subVI is not even really needed). Must the main VI code wait until the subVI returns or does it need to do other things in the meantime? What else does the subVI do? What is the purpose of it all?

0 Kudos
Message 6 of 7
(3,737 Views)

thanks for helping. this is good enough for me

0 Kudos
Message 7 of 7
(3,703 Views)