LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"wait" and "wait until next ms multiple"

Hi folks,

If I have a wait VI and other VIs in the same loop.
Would other VIs excute first, hold for the wait time,
then go on to next loop or it waits then other VIs excute?

I appreciate your input...

Thanks.

K-L
0 Kudos
Message 1 of 3
(3,096 Views)
kchen wrote:

> Hi folks,
>
> If I have a wait VI and other VIs in the same loop.
> Would other VIs excute first, hold for the wait time,
> then go on to next loop or it waits then other VIs excute?

Execution-wise, there's nothing special about the Wait VIs; dataflow
will determine the order of execution of these and the other objects
within a loop. So, if you have a Wait node sitting all by itself and
another piece of code on the other side of the loop, there's no way to
tell if 1) the Wait will execute, then the other code, 2) the other code
will execute first, then the Wait, or 3) Part of the other code will
execute, then the Wait, then the rest of the other code. Any of these
things could potentially occur.

If you're certain that your main loop code can always e
xecute faster
than the time delay you specify for "Wait Until Next ms Multiple," then
what you've got is a software-timed loop where the loop code is executed
once per time interval specified. The degree of regularity of the
execution will depend on what else your computer's processor is being
asked to do at the same time (mouse, other I/O, other numerical
calculations, etc.).

There's a wrinkle if you instead use the "Wait (ms)" node. The
following KnowledgeBase entry on the NI Web site gives a good
explanation of the difference between these two Wait functions:

http://digital.ni.com/public.nsf/websearch/12b2ea9ad5b265ad86256257004dd8e2

Best Regards,
John Lum
National Instruments
0 Kudos
Message 2 of 3
(3,096 Views)
"kchen" wrote:
>>Hi folks,>>If I have a wait VI and other VIs in the same loop.>Would other
VIs excute first, hold for the wait time,>then go on to next loop or it waits
then other VIs excute?>>I appreciate your input...>>Thanks.>>K-L

Hi K-L

If the goal of your question was to understand how the "wait" is working,

John Lum from National Instruments give you the right explanation.
Also if in your question you like to arrange the wait the way you want.
You can used sequence (Function/structure/sequence). But be carefully with
sequence.
By using the sequence you loose a bit of the visibility of the flow.
I recommend dataflow link between your sub.vi.
Labview is base on dataflow. By passing variable (control) from VI to other
VI yo
u can see rapidly the link and the order of your VI.
You can send a control to a second VI without need this control on the second
VI.
By doing this you have the link between the two VI. And on this way you control
the sequence of your wait.
Hope that help.

Rejean
0 Kudos
Message 3 of 3
(3,096 Views)