LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to vary time between iterations of a loop

hi,

 i'm doing animation of grinding process in labview and am making animation only by plotting series of xy graphs for each iterations of a while loop,for doing this i want each itteration of while loop to run for specific period of time. how to do that?

0 Kudos
Message 1 of 18
(4,722 Views)
With the Wait(ms) or Time Delay function and an array of values that you pass in. A for loop would be better.
Message 2 of 18
(4,715 Views)

actually i want the component to rotate with some angular velocity,i have a array of angular velocities whether this will help to give delay...please reply

0 Kudos
Message 3 of 18
(4,705 Views)

Show your VI (not a picture, but a snippet or attach the file itself) and explain what exactly is your goal here. So people can give more specific help...

0 Kudos
Message 4 of 18
(4,685 Views)
The functions I mentioned will give a delay between iterations. I don't know what else you need. Perhaps the Elapsed Time function would work.
Message 5 of 18
(4,684 Views)

first use elapsed time vi with appropriate accuracy to find out how much your code make delay in every loop then you can have good view of what you should do for time of  iterations

 

Message 6 of 18
(4,626 Views)

Why would you need to use Elapsed Time Express VI?  He doesn't want to know how much time has passed.  He wants to have the loop iteration take a certain amount of time.  The Wait function does that.

Message 7 of 18
(4,611 Views)

I believe Hatef was suggesting to find the elapsed time of the loop without any waits. So if the code takes 40ms to run, and he wants it to update at 100ms, he could put a 60ms wait in the loop. If that is true, I would just use the "Wait until next" VI instead of "Wait".

Message 8 of 18
(4,594 Views)

Indeed what I want to say ,is that we should care about elapsed time  for any  iteration before use wait 
suppose answer is 120 ms elapsed time so dose 40 ms wait make sense? when  your code make 120ms wait itself 

Message 9 of 18
(4,580 Views)

Why would you need to do that?

 

The wait would run in parallel to all other code.  Let's say you want a 100 msec loop iteration.  Put in a 100 msec wait.  If your code runs in parallel and only takes 20 msec, the loop iteration still only takes 100 msec because it is waiting for the wait function to finish.  The first 20 msec of wait happens in parallel to the actual code, the remaing 80 msec of wait happens with nothing else executing.   If the code takes 95 msec to run, and the wait is 100 msec, then the loop will still only take 100 msec.  The first 95 msec of wait happens in parallel to the actual code, the remaing 5 msec of wait happens with nothing else executing

 

If your actual code takes 150 msec to run, the loop iteration will extend to 150 msec.  The wait function will return after 100 msec, but the actual code has only completed 100 msec of work and the loop won't iterate until the execution of the remain 50 msec of code happens.

Message 10 of 18
(4,574 Views)