LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

while loop

Hi Guys,
I would like to know if there is any possibility to send data out of a whileloop? in my attached snapshot I want to read out the number of iteration(loop count) when the program execute, but I can only see the result of last iteration that is normal while usinge a whileloop but is there any other possibility to see data toggling out of the while loop?
 
Beni.
0 Kudos
Message 1 of 7
(3,415 Views)
There are many ways you can use Globals (not recomended), local variables, property nodes, LV2 style globals, ques. look at the help for using each one. also search for some tutorials on how to use them.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 2 of 7
(3,396 Views)

I don't get you, anyway, I am asking that question because I just want to make a subvia of the application and of course some indicators shows the last iteration value which is normal because of the while loop, I am surching for a way to read out data for each iteration out of the while loop.

 

thx

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

I would recommend that you look at a queue implementation.  You can enqueue the data inside your subvi and then dequeue the data outside the subvi.  You could also use notifiers, but be aware that there is the potential for lost data if not programmed properly.  There are shipping examples with LabVIEW which show the use of each of these.

You may also use LV2 style globals (also called functional globals).  LV2 globals have distinct advantages over standard globals with regard to race conditions in the program.  LV2 globals use a single iteration loop with a shift register in which to store the data.  There is a significant amount of information on this forum about the use of LV2 globals in your programming.

Message Edited by John Rich on 07-26-2005 09:13 AM

Message Edited by John Rich on 07-26-2005 09:13 AM

0 Kudos
Message 4 of 7
(3,370 Views)

Hi,

If I understand what you mean... You have a subvi with a whileloop inside. you connected the Iteration counter to an indicator

So, in your top vi you get only the last iteration count. That is completely normal. The top vi gets the value of the indicator after

the subvi completed his job.

If you want the iteration counter to change while the loop is runing, you should use a reference to the indicator on your top vi and

use a property node to change its value.

 

Dai

LV 7.1 - WIN XP - RT - FP
Message 5 of 7
(3,356 Views)
Here is a vi that uses a couple of examples for you to try.



Joe.
"NOTHING IS EVER EASY"
Message 6 of 7
(3,348 Views)
thx for support,
it is working fine!
 
 
0 Kudos
Message 7 of 7
(3,320 Views)