How Can We Help?
Timer & Timer Compare
Timer & Timer Compare
This covers both the Timer Block (lower highlighted tool) and Timer Compare Decision Block.
Timers keep track of time elapsed while Timer Compares check to see if desired time has elapsed.
Timer
Timers are background functions. Once you start a Timer, it will continue to run, until you Pause it.
Timers cannot be passed into or out of Subroutines, but their values can be.
Start/ContinueTo Start a Timer, select Start/Continue. Provide an I32 Tag in the “Timer slot”. This is where the time is kept. The time elapsed is stored as number of milliseconds since timer was started. It will not initialize the timer value to 0. It start it or restart it after a pause. |
|
PausePause stops the timer, but retains it’s value. |
|
ResetReset puts a 0 in the Timer’s Tag. It doesn’t stop the Timer. |
Timer Compare
Once you’ve created a Timer, you probability want to test if an amount of time has elapsed. For this we use Timer Compare.
In Timer Compare you must select your Timer Tag in the leftmost slot. The right slot can have a number or Tag. The right tag uses the drop-down to specify the time you’d like to use in the comparison.
Here, we will show how to have a state for execute a task only once, from top to bottom of the cycle, when the PLC boots.
This state will never run again until the next boot. Usually used to initialize variables.
|
Example Timer Application
- We start (or continue) the timer.
- We check if we are > at 5.5 seconds.
- If yes, OutBitD1 = 1
- We check if we are > at 7.5 seconds.
- If yes, OutBitD1 = 0 and we reset the timer
As you can see, we can reset the timer in another way.
The idea is to let always the timer running. Just reset it when you need it !
Have a look how the Timer works: Start, Pause and Reset