LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Determing "For Loop" execution order

Hello,
 
  I have two for loops in my block diagram, one on the left and one on the right. I want the execution of the for loops to be done sequentially.
The for loop on the left needs to be completed before the for loop on the right is completed. What signal can I get out of the for loop on the left to determine when the for loop on the right is started?
   I am assuming that when the code starts up the 2 for loops will execute in parrallel and I want sequential operation.
Regards,


Kaspar
0 Kudos
Message 1 of 8
(3,970 Views)
This is elementary dataflow programming. When all the inputs to a node (Where a node can be approximately defined as anything with a closed boundary around it) have data, then the node can execute.

So the answer to your question is that any output from the first for loop can be connected as an input to the second one. The input does not need to be used. If your first loop does not have any outputs then wire the "N" box to the output (disabling indexing) and connect this output to the border of the second loop. It need not be wired inside the second loop to anything.

Lynn
Message 2 of 8
(3,962 Views)

Hi

If you want them to execute sequentially, you have to connect them somehow. You can do this with every datatype. If you have date out of loop one, which is needed in loop two, just wire it over to it. If they do different tasks, you can wire a boolean constant out of loop one to loop two.

But take care, that you do not enable indexing on this wire! Otherwise your second loop will not iterate the correct number.

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 3 of 8
(3,961 Views)
Hello,

What you can do to make sure that the second loop starts only when the first is finished is link a data that is inside the first loop to the second loop.
This way, the second loop will automatically wait to receive the linked data from the first loop to begin. This is the "data flow" a bit af code will wait until it receives all the data it requires to execute 😉



Message Edité par TiTou le 07-13-2006 03:50 PM


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 4 of 8
(3,959 Views)
I though I would never say this, but if you don't want to create some artificial data dependency, use a flat sequence structure.
 
The second frame must wait until the first frame (and thus everything in it) has finished. 😄
 

Message Edited by altenbach on 07-13-2006 07:03 AM

Message 5 of 8
(3,948 Views)
.. but be aware that if you use sequence structures some guys will tell you NOT to use them for some special reasons...:-)
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
Message 6 of 8
(3,936 Views)
Hey! 😄
0 Kudos
Message 7 of 8
(3,918 Views)
uh-oh.. been talking bout myself of course....
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 8 of 8
(3,888 Views)