LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timed loop - timing not consistent

I have a timed loop that I want executed every 25ms.  Upon looking at the time stamp, I get data every 16ms or 32ms.  According to this article the accuracy for Windows XP should be 1ms. http://digital.ni.com/public.nsf/allkb/859DA6BB71B8A84F86256B3A0071141C What can I do to get more consistently timed reads?

 

Thanks!

 

 

 

timed loop.JPG

0 Kudos
Message 1 of 15
(3,693 Views)

This thread might help you.

 

Ben64

0 Kudos
Message 2 of 15
(3,686 Views)

Works fine in Windows 7. What is your processor? Is this plain Windows XP or a virtual PC?

 

 

What do you get if you measure it the right way?

 

 

Download All
Message 3 of 15
(3,683 Views)

I'm running Windows XP Professional on a desktop PC.  I have an Intel Core 2 Duo CPU.  2.2GHz with 3GB RAM.

 

If I write out the Period I get 25ms.  But if I take a delta these are my times.  I have tried it on 3 different computers all running Windows XP Professional and the results are similar.

delta.JPG

 

0 Kudos
Message 4 of 15
(3,650 Views)

Also, what is your LabVIEW version?

0 Kudos
Message 5 of 15
(3,643 Views)

I have 8.5

0 Kudos
Message 6 of 15
(3,635 Views)

Two things to check:

1) Prevent memory allocation:

Change your "benchmark" to terminate after a given number of iterations (e.g. 200). Create an array for your timestamps beforehand and replace the appropriate element during the loop in order to prevent LV to allocate new memory each iteration (and copying the array around a lot).

 

2) Prevent CPU Core swaps:

Using the Windows Task Manager, set the process LabVIEW.exe to only run on a single core. To do this, rightclick LabVIEW.exe process in Task Manager and select "CPU  Affinity". Deselect all cores except one.

 

I wouldn't expect test 2) to give any different numbers than those you are seeing, but give it a try....

 

Norbert 

 

EDIT: Don't forget to reconfigure your LabVIEW.exe process to use both cores once finishing the test. Restart LV should also enable both cores again...   

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 15
(3,605 Views)

Hi,

 

in WinXP the resolution of that timing function is limited to 15.6ms. So your results will always show differences of (multiples of) 15.6ms...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 15
(3,603 Views)

Is there a work around for this limitation or is this something I have to live with?  Thanks!

0 Kudos
Message 9 of 15
(3,560 Views)

Hi akelei,

 

see for yourself:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 15
(3,549 Views)