LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Looping Time Less Than 1 ms

Could the wait time in a loop be less than 1 ms when Windows XP OS is used?
Message 1 of 12
(5,658 Views)
If you are using the wait function you can set it to zero but it will not do much good if you are on a windows machine. No matter what you set it to you will be at the mercy of Microsoft.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 2 of 12
(5,630 Views)
Hi

I just wanted to add that even if you set it to zero, the call to the Wait function makes the while loop yield so that other tasks can be scheduled.  For a much more detailed explanation see here:

http://forums.lavausergroup.org/index.php?showtopic=258

Regards,

Robst.



Robst - CLD

Using LabVIEW since version 7.0


0 Kudos
Message 3 of 12
(5,628 Views)
If I would like to record 2 sets of data at 1-ms sampling rate each, could I write two parallel loops each with a 1 ms wait?
0 Kudos
Message 4 of 12
(5,617 Views)

Instead of a regular loop, you should use a timed loop (ot two timed loops in this case).

Their timing is much more tightly controlled and they even keep you informed if an iteration finishes late, etc. Check the online help for more information.

Message 5 of 12
(5,608 Views)

Keep in mind that the Timed Loop is only available in LabVIEW 7.1 and later.

-D

0 Kudos
Message 6 of 12
(5,588 Views)

The timing VIs use calls to windows to monitor the PC's millisecond timer.  Therefore you cannot receive any time granularity less than a ms, but to make it worse since you are making a windows call you (as mentioned before) are at the mercy of the OS's scheduler.  I guess a "workaround" is to embed some sort of VI in a loop you can estimate the execution time on (such as a for loop iterating over nothing for 1000 times).

Best of luck!

0 Kudos
Message 7 of 12
(5,570 Views)
Hello LVNA,

I think your "workaround" is no good idea. It went wrong 25 years ago and it will call for trouble now! Such a loop is heavily processor dependent...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 12
(5,560 Views)
You can off course.

Just repeat the code you need to
execute in a loop as many times as you want
your loop to run faster than 1 ms, and
don't forget to set "Wain until next ms multiple"
to 1 ms.

It is not very beautiful and cannot
solve special problems but it works fine
even on Win.
0 Kudos
Message 9 of 12
(5,551 Views)
This won't work very well.  You'll end up with the code in the loop being executed N times, and then a pause, then N times, then a pause with each cycle being repeated every ms.

This means that the time between individual "measurements" is different depending on whether you have successive runs within the same iteration of the loop or not.

I can imagine that this will mess with many data analysis functions.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 10 of 12
(5,531 Views)