LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tick Count Reliability

Solved!
Go to solution

Tick_Count.PNG

Hello.

 

I want to use this simple code to calculate the time in milliseconds passed during a cycle, accurate precision is not important.

Although it does work, in help file it says in the description:

 

"...Be careful when you use this function in comparisons because the value of the millisecond timer wraps from (2^32)1 to 0."

 

How can I avoid this problem? This timing should be used to control the pump valves, and if it will bug one day it will blow up the engines.

 

Secerely.

0 Kudos
Message 1 of 3
(2,245 Views)
Solution
Accepted by topic author aias

If you subtract (as your example shows), then you should have no problem, because subtraction works correctly when the integer wraps around (i.e. if you were using a U8 10 minus 250 would correctly produce 16).

 

The only exception to this is if you wrap around twice before doing the substraction, because then you would miss one entire cycle, but since 4.2 billion ms is roughly 50 days, this is not very likely to happen.


___________________
Try to take over the world!
0 Kudos
Message 2 of 3
(2,238 Views)

Thanks!

0 Kudos
Message 3 of 3
(2,234 Views)