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

We appreciate your patience as we improve our online experience.


Showing results for 
Search instead for 
Did you mean: 

While Loop vs Timed Loop

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
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



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.



Message 3 of 3