LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does a sequence structure execute if a while loop is to the left of it?

  I have a while loop in a case structure whose boolean is wired to a sub vi.  To the right of this structure I have a sequence that executes regardless of the while loops condition.  I assumed that the program would not continue to the case structure until the while loop stopped.  Then it would proceed to the case structure.
 
Thank You
0 Kudos
Message 1 of 5
(3,847 Views)

Could you post your code or at least a picture of your code? It's very hard to help you with such problems, if one cannot look at the code.

Imagine a customer or a user of your software calling you and telling you that if he clicks a button the program hangs. You would want to know which button and under what conditions. So do we - the more information you post, the faster you get a useful answer.

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 5
(3,842 Views)
Hi jemengine........,
 
independent of  becktho's correct answer ............... - I think you make a very simple mistake. The execution-flow in LabVIEW is not dependent
from a position ( left / top / right .... or whatever ) ; it is direct dependendent from signal-flow.  If you connect yor sequence structure - maybe
by a dummy-connection from output of you while loop - then it will wait until your while loop stops and then execute the sequence.
 
But this is pure   BASIC's  of LabVIEW   -  you should know this ....................
 
Regards
 
Werner
0 Kudos
Message 3 of 5
(3,838 Views)


@jemengineering wrote:
  I have a while loop in a case structure whose boolean is wired to a sub vi.  To the right of this structure I have a sequence that executes regardless of the while loops condition.  I assumed that the program would not continue to the case structure until the while loop stopped.  Then it would proceed to the case structure.

As others have mentioned, you have to familiarize yourself with the core idea of dataflow programming. One of the great powers of LabVIEW is the fact that things can occur in paralell unless there is data dependency.

A good start would be the LabVIEW beginners online tutorial:

http://www.ni.com/swf/presentation/us/labview/aap/default.htm

The quiz #1 on slide 11 deals with the above issues. Try to answer it. 😄

 

In your particular case, you need to force execution order. This can be done by creating a data dependency (preferred) or by the use of a sequence structure. You could e.g. create a 2-frame flat sequence and place the loop in the first frame and the case structure in the second frame.

The picture shows a few scenarios for comparison. Can you spot the differences? 🙂 Understanding dataflow is crucial for writing any LabVIEW program.

Message Edited by altenbach on 07-31-2006 06:49 AM

Message 4 of 5
(3,820 Views)
As an additional comment to the picure above, the second case will act differently to the last two:
 
Only in the last two scenarios you can keep modifying the boolean for the case structure until the loop has finished and the last value will be used when the case starts.
 
In the second scenario, the boolean (boolean 2) is immediately read in paralell with the while loop, thus the value used when the case structure stars will be the value at program start. (Only the case structure has a data dependency from the while loop, but not reading the "boolean 2" control).
 
You can easily verify this using execution highlighting.
 
Things to keep in mind! 😄
Message 5 of 5
(3,798 Views)