Example Code

Wait (ms) and Wait Until Next ms Multiple Explained

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

Coding that demonstrates how the "Wait (ms)" and "Wait until Next ms Multiple" functions work in a different way.

 

Description

This VI goes through two common wait VIs in LabVIEW: Wait(ms) and Wait Until Next ms Multiple. There is often a questions of when to use each and what the difference is. Exploring this VI will increase your awareness of the difference of the two functions and how they interact with one another.

 

There are four cases explored in this VI, and each has a designated tab on the front panel:
0. Wait (ms) - This is the most basic wait function, where the VI will wait a specified number of milliseconds.
1. Wait Until Next ms Multiple - This VI will wait until the system clock has reached a multiple of the specified millisecond amount.
2. Wait & Wait Until - This case explores how the two VIs work when used in parallel. Try this case with different values to see which controls the execution timing.
3. Wait Until Next Explained - This case has a little bit of math that calculates why the Wait Until Next ms Multiple VI waits the amount of time that it does.

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code
1. Select the tab you would like to run
2. Set the time you would like the functions to wait
3. Run the VI

 

Additional Information or References

Snippet.png

Eric S.
AE Specialist | Global Support
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
LV_learner
Member
Member
on

Excellent example!   It helps a lot to understand the REAL functions of these two timing blocks. 

Broken_Arrow
Active Participant Active Participant
Active Participant
on

Well done, thanks! 

Richard






sivarama
Member
Member
on

Good example and cleared my doubts about these functions

sevincom
Member
Member
on

Really good example with all questions answered

ds28
Member
Member
on

Can any one please tell me, how I can get the specified value to wait(ms) timer as output from it (Supposing 10 is the input to the wait(ms) timer,  how I can 10 in the numeric indicator if I wire it to its output. 

 

暗藏
Member
Member
on
Thank you very much for sloving the problem that has been confusing me.