LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time delay for motion control

Hi, I�m using LV to move a linear stage stepwise. I use �Wait until next ms multiple� in a �for� loop to specify the time delay between the steps. When the time is set to 2000 ms, things are fine. But when it is set to < 1500 ms, the time delay is significantly shorter between the first two steps, although the delays between subsequent steps are OK. I need to have the time delay < 1500 ms and consistent. What should I do?
Many thanks,
THz
0 Kudos
Message 1 of 8
(3,305 Views)
Hi,
Why don't you use the "wait (ms)" stock VI. This enables you to wait for the specified time.

Here's a little explanation between the VI you've used and the "Wait (ms)" VI : http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/12b2ea9ad5b265ad86256257004dd8e2?OpenDocument

Hope this helps !
Julien
Message 2 of 8
(3,305 Views)
Thanks a lot Julien. I just changed to "Wait" and it works perfectly even with very small time delay. I had never actually understood the difference between the two VIs until I read that explanation. Many thanks.

Btw, I have another question regarding the time delay. Is there any simple way to have the time delay elapsed before the loop starts the first step? I'm thinking of having a sequence structure with just the time delay in the first frame and the loop in the following frame. Any better way?

Thanks,
0 Kudos
Message 3 of 8
(3,305 Views)
What you could do is either :
- place a sequence structure before the loop and put your wait function in that (single frame) sequence.
- or place the sequence structure before each iteration of the loop.

See in the picture attached... in each case you need a data dependency (shown by the error cluster on the picture)
Hope this helps !
Julien
0 Kudos
Message 4 of 8
(3,305 Views)
LabVIEW 7 has the Delay function with error in/out connections so you could use those for data dependency instead of a sequence structure. Older (and current) versions have a Wait(ms) function with error in/out as well but it's kind of hidden. If you go to the Data Acquisition>Counter>Intermediate Counter palette, you'll find Wait+(ms). Besides the error connections, you can specify the wait time in either msecs or seconds.
0 Kudos
Message 5 of 8
(3,305 Views)
Thanks Julien and Dennis. What do you mean by data dependency? Why do I need it? Please explain to me just anything, I'm new to LabView. Cheers,
0 Kudos
Message 6 of 8
(3,305 Views)
LabVIEW is a dataflow language. The order of execution is detemined by data flowing from one function to another. A function will not execute until all of its data is present. Those functions that are not connected by wires, will not have data dependency and LabVIEW will attempt to execute them in parallel. That is why we can have things like while loops running in parallel. One way to enforce execution flow is with the sequence structure. Whatever is in sequence frame 1 will execute before the functions in frame 2 even if there are no wires connecting the functions. A better way is to make use of the error in/out connections that most VIs have. Besides keeping track of errors, connecting the error out of one VI to the error in of another,
enforces data flow without having to use a sequence structure.
0 Kudos
Message 7 of 8
(3,305 Views)
Thanks for the explanation Dennis. I just tried both ways suggested by you guys and they both work fine. Many thanks. Have a good weekend. Will have more questions next week 🙂
0 Kudos
Message 8 of 8
(3,305 Views)