LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Async Timer functionality dies

Hello,

 

I have an program that uses two 1ms interval async timers running in parallel threads.

 

I have been using this for 8 years, starting with CVI 2015, and Windows 7.

 

Recently, after having upgraded to Windows 10 and CVI 2020, and restructuring the program, the timers simply stop working after ~24.5 days.

 

Everything is perfect until they stop.

 

This is an test stand program, assuming no test issues, that runs 24/7 for up to 6 months at a time.

 

I understand from the async timer documentation that this may not be the recommended strategy, but it has worked solidly for 8 years, so something has changed, either in CVI or Windows 10.

 

Any hints are greatly appreciated.

 

Dr. Terry Moss

Technical Manager

Robert Bosch Charleston SC

0 Kudos
Message 1 of 7
(1,606 Views)

That corresponds to a 31-bit rollover as expressed in milliseconds. You might want to dig around that.

0 Kudos
Message 2 of 7
(1,578 Views)

Thanks for the feedback.

 

Yes, we have been considering that, but why should a 1ms timer overflow?

 

If we set a timer with a 30 day interval, it would make sense.

 

We've been running error free 24/7 for years with the same setup.

0 Kudos
Message 3 of 7
(1,559 Views)

There used to be a problem in the past in UI timers and Timer () function which were using 32-bit unsigned integers to count milliseconds: that was producing a rollover every ~49.7 days. That problem however has been solved back in CVI5.5 times and never affected async timers which rely on a different mechanism to operate.

 

A rollover on a 31-bit basis is quite strange, unless a signed integer is used instead of unsigned but again it should happen out of timer environment: are you using timer values somewhere in the program and which calculations are you performing on them? Has some of program timing functions been affected by the refactoring you performed while transitioning to CVI2020?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 7
(1,540 Views)

Interesting,

 

We think we found a problem with the error checking on the timer.

 

It was using a float variable with a Timer() function to over check the timer.

 

Apparently as the Timer() value increases with run time, the float variable looses resolution.  Once it looses enough resolution, the timer appears to timeout instantly, causing this bug.

 

The original code used a double, and ran for years...

 

Thanks for the advice.

 

Thanks for the

Message 5 of 7
(1,528 Views)

Hello Terry. Do you want to say, thats an internally async timer problem or a problem with your self made code?

0 Kudos
Message 6 of 7
(756 Views)

It was definitely a problem with my code.

 

I was using a float to do the timer comparison, and it was wrapping around, changing it to a double fixed the problem.

 

Our benches run for months at a time, so we are a little more sensitive to bugs like that.

 

Thanks...

0 Kudos
Message 7 of 7
(746 Views)