LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What order does LabView read the block diagram?

Would it be left to right, top to bottom, or is there no specification? everyhting happens at once?

Thanks! Ivanka
0 Kudos
Message 1 of 5
(3,505 Views)
hi,
there is nothing like LEFT to RIGHT,TOP to BOTTOM ,it goes by the code flow if you want to be sure of the flow you can make use sequence structures,by this you can be clear of the flow.
vicky
0 Kudos
Message 2 of 5
(3,505 Views)
There is no specification. If you need a specific order you can e.g. use
sequences or create dependencies by the data flow.

IBAHKA wrote:

> Would it be left to right, top to bottom, or is there no
> specification? everyhting happens at once?
>
> Thanks! Ivanka
0 Kudos
Message 3 of 5
(3,505 Views)
Unless there is data dependency code will operate in parallel mode. Do not make the mistake of thinking that just because code executes in a certain order in debug mode that it will execute in this same order in run mode. The only way to insure execution order is to force execution order.

There are several ways to force the order of operation if this is necessary. Sequence structures have been suggested by both vicky and LunaBlue. Sequence structures are generally frowned upon by experienced LabView users, mainly because these structures are more difficult to read when it comes to debugging or altering the code. The flat sequence structure can be used to overcome this, but other alternatives are still generally better.

One way to force the sequence
of operation is through the use of a state machine architecture. A good place to start is with the state machine example which is included with LabView. There is also a lot of information included in this forum with regard to state machines.

Another way that I have used on occassion when I know that there is only one desired sequence of events is to separate the code into sections that you then place in subvis. Each subvi will have an error in and error out terminal which is used to control the sequence of operation. These subvis are chained together in the main vi in order to get the desired order of operation. This is similar to the flat sequence method but, IMHO, is more versatile.
Message 4 of 5
(3,505 Views)
To clarify on this subject, every icon on the block diagram will execute only when all of its inputs are present. For example, the add icon has two inputs. The addition will not take place until there are numbers at both inputs. If one of the add inputs comes from a divide output, the divide will take place before the add. The best way, and probably the most accepted way, to control execution flow is to use the Error In and Error Out terminals. Always create sub-vi's with Error icons. When wiring two sub-vi's, the vi's will not execute until all of its inputs are present, including the Error In. So you can control which sub'vi to execute first by using the Error terminals. If two or more groups of icons are not connected to each other in any way,
the groups will execute in parallel, there is no guarantee in which order they will execute. By following the wires, you can trace the execution flow.
- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 5
(3,505 Views)