From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While Loop vs Timed Loop

Solved!
Go to solution

Is there any difference between a Timed loop and a While loop with a wait function in it?
I tried to test the difference by running one of each loop in parallel, then checking the speed:

From what I saw, they run either exactly the same or within 1 ms of each other.

But that 1ms, if you were to look at % error would be X*10^-7 so it doesnt make much difference.


Does anyone know why someone would use one over the other?

Cory K
0 Kudos
Message 1 of 3
(2,801 Views)
Solution
Accepted by topic author Cory_K

The main difference is you normally want a timed loop in a RT OS, while a "normal" loop in Windows.

 

You can control priority/processor/etc in a timed loop.

 

But the biggest difference is the lack of multithreading in a timed-loop. (In my opinion)

Chris Van Horn
Applications Engineer
0 Kudos
Message 2 of 3
(2,797 Views)

Cory,

 

I cannot answer your question exactly but I will point out that the Timed loop is tied to one OS and is not cross platform.

 

Lynn 

Message 3 of 3
(2,796 Views)