News:

  • June 26, 2026, 06:45:54 AM

Login with username, password and session length

Author Topic: Timer Maximums  (Read 8736 times)

Evilbeard

  • Hero Member
  • *****
  • Posts: 160
Timer Maximums
« on: February 24, 2017, 06:06:26 PM »
I'm making a machine runtime counter for a project, and I know the preset will go to 99hr 59m 59.99s, but what is the maximum range on the counter? What I'm wanting to do is use the timer's .acc to calculate the runtime minutes of the machine, but I wasn't sure if I'd have to "roll" the timer over so that it doesn't max out and cause issues.

Garyhlucas

  • Hero Member
  • *****
  • Posts: 421
Re: Timer Maximums
« Reply #1 on: February 24, 2017, 06:30:13 PM »
I just increment a D word using a built in second, minute, or hour timer or use a timer to do the same thing.

Mike Nash

  • Hero Member
  • *****
  • Posts: 652
Re: Timer Maximums
« Reply #2 on: February 24, 2017, 07:34:29 PM »
I would think an accumulating up timer TMRA would work pretty well. From the help:

Quote
The maximum Time value in this form is 569 hours, 31 minutes, 23 seconds, and 647 milliseconds. If needed, the value entered for the Timer Preset will be normalized to its standard value. For example, if you entered a value of  97 Seconds, that value will be converted and displayed as 1 Minute and 37 Seconds.


Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3609
  • Darth Ladder
Re: Timer Maximums
« Reply #3 on: February 25, 2017, 10:34:21 PM »
I think I'd use a timer that can go over an hour.  Then each scan, check if the timer Acc is over an hour.  If it is, add one to your hour counter (really just a N, V or D register), and subtract an hour worth of ms from the Acc.  That way you avoid building up error because of scan latency delaying the check.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.