
Cgarai (Customer) asked a question.
Off Delay timer doesn't work properly
Hi,
I'm trying to use an OFF DELAY Timer. It works, but it seems the time units are not being counted correctly. I.e., if I set it ms it takes about 40 real seconds to count to 1000. The timer is set in a subroutine that is visited every second which makes me wonder if that is the issue, but I would have thought that Timers do not have to be visited to continue counting.
Any ideas?
Thanks
Chris
You didn't specify which controller you're using but this behavior is common for timers. In general, timers will not function correctly in periodic tasks/subroutines. Timers need to be ran every scan in order to accumulate time properly. There may be exceptions to this but this is most likely causing the problem you're seeing.
I found an article about timers. I wonder if you are interested in reading it.
Sub routines have to be scanned to operate. if your wanting to execute something in the routine based on a time interval then use a counter triggered by one of the system clock tags then when the output on the counter is reached enable the routine until it is finished then clear the counter while in the routine. I use timers in subroutines all the time but have program control flags to exit the subroutine if the timer has not expired.