LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the freqency of this simple program

Can anybody tell me if I can put a while loop inside another while loop? And what is the frequency of each loop. What is the difference between "wait until next ms multiple " vi and "miliiseconds to wait" vi? Because they are both used to control the loop frequency. What is the different? I am confused. Thank you.
0 Kudos
Message 1 of 4
(2,622 Views)
The inner loop will run every 10 ms until you press the inner stop button, at which time the outer loop will spin once and the inner loop will again spin forever, until you press the inner stop button again. (Assuming the buttons are latch action)
 
Remember, the outer loop must wait for the next iteration until all nodes in it have finished. This only happens whenever the inner loop stops.
The timer in the outer loop does not do much....
 
If you want the loops to run independently, they must be next to each other.
 
"Wait next ms" multiple waits for regular elapsed intervals
 
"Wait ms" takes a break for the given time.
 
Analogy:
 
Wait next ms multiple: do something every hour on the hour, etc. (The break will depend how long it takes you for each job).
Wait: Do something, when done take a one hour break, do something, etc.
 
A wait next ms multiple is typically used inside a loop so the loop executes at regular intervals, for example every 100 ms. It should not depend if the calculations in each loop take 1 ms or 50ms, the repetition rate will be constant. (Of course if the calculations take 200ms you have a problem ;))
 
A plain wait is used if you need to wait a given amount of time, e.g. send a command to a device, wait 200ms, the send another command. Show a popup window for 2 seconds, wait for a timeout, etc.
 
For more details, read the online help on the two. 🙂

Message Edited by altenbach on 09-21-2005 07:44 PM

Message 2 of 4
(2,616 Views)
Thank you very much!!! That means the outside while loop can only run once unless the inner while loop stop. Then I think put one while loop inside enother while loop is useless. Thank you for your help!
0 Kudos
Message 3 of 4
(2,607 Views)

Nothing is useless, it really depends what you need to do 🙂

Sometimes stacked loops can be the solution to a certain programming problem. 😉

Message 4 of 4
(2,602 Views)