Lately I’ve been reading some PLC brochures, I noticed one vendor bragging that his smallest PLC provides 7 types of timers and timing functions, presenting this as a differentiating factor between his PLC and the other brands. As much as the words sound tempting, from a practical point of view, these 7 types have no real value, except for the very lazy PLC programmers.

Don’t get me wrong, timing and sequencing are key functions in any control system, I can easily assume there is no control application that doesn’t contain at least one timer. But dancing around the timer “types” as a selling point just seemed misleading to me.

Practically, you can derive any type of timer or timing function, by correctly utilizing the most basic type of timer, the ON DELAY. Here we will show examples of deriving three types of timers (or timing functions):

  • OFF DELAY Timer
  • ON+OFF DELAY Timer
  • FLASHER

Before we show how, let’s take a look at how the ON DELAY timer works.

The Master of All the Timers! ON DELAY

Compared to a normal relay, a relay is a device that switches its outputs (ON or OFF) immediately with the changes with its input state.

An ON DELAY Timer on the other hand, is similar to a relay, except it turns the output ON after a certain DELAY, and that’s how it got its name, ON DELAY. Turning off the output is similar to a normal relay, it happens immediately.

On-delay-timer-diagram

In a ladder diagram, the use of an ON DELAY timer block is very simple, the block receives a COMMAND, and after the preset time has elapsed, the timer output contacts (TM1.OUT) are switched, turning our OUTPUT ON or OFF.

On-delay-timer-ladder

As in the ladder diagram above, all-over this post we are going to use the term COMMAND to indicate the condition to start the timing function, the term OUTPUT to indicate the result of the timing function, and TON DELAY for ON DELAY timer blocks.

OFF DELAY Timer

An OFF DELAY Timer is similar to a relay, except it turns the output OFF after a certain DELAY, and that’s how it got its name, OFF DELAY. Turning ON the output is similar to a normal relay, it happens immediately.

Off-delay-timer-diagram

Below is a ladder diagram that shows how to derive the above OFF DELAY timing function by utilizing an ON DELAY timer.

Off-delay-timer-ladder

The first rung is a simple; once the COMMAND is active the OUTPUT will turn ON immediately, the OUTPUT is self-latched so when the COMMAND is no longer active, OUTPUT stays ON, until the output of the ON DELAY timer “TM1.OUT” is active, that will cut the line feeding OUTPUT and so de-energize it.

Second rung is the timer rung; it simply shows the condition that must exist before the timer should start counting the 3 seconds preset value. COMMAND must be inactive while OUTPUT must be active, this combination guarantees the timer starts only after COMMAND has already been ON and then turned OFF again.

Did you test it on your simulator yet? Works like a charm.

ON+OFF DELAY Timer

As how the name indicates, it’s a combination between the ON DELAY and the OFF DELAY timers, so it introduces a delay before turning OUTPUT ON when the COMMAND is received, and also introduces a delay in turning the OUTPUT OFF when COMMAND is gone.

On-off-delay-timer-diagram

This one needs two timers:

  • One to calculate the delay before turning ON the output (TM1)
  • One to calculate the delay before turning OFF the output (TM2)

On-Off-delay-timer-ladder

Note: The above diagram can be consolidated in one rung, yet not all brands of PLC software would allow you to do that, so for clarity and generality let’s keep the rungs separated.

This ladder follows the same methodology as the one used to demonstrate the OFF DELAY timing function, with the addition of a 2 seconds ON DELAY timer to introduce the delay before COMMAND turning OUTPUT ON.

FLASHER Timing Function

This was really funny in the PLC brochure I mentioned in the beginning, the PLC vendor considered that he have two separate types of timers, synchronous flasher (ON time is equal to OFF time), and asynchronous flasher (ON and OFF times are different), what a fluff.

Let me show you here how to make a GENERIC flashing function that works synchronously or asynchronously.

To program any two-step, time based cyclic operation, you need to define two periods (two preset values for two timers):

  • The ON period
  • The CYCLE period

Flahser-diagram

What you want to do is to have our flasher ON once the COMMAND is active for 1 second (TM1), then have it OFF for 0.5 second, that makes our total CYCLE period 1.5 seconds (TM2), have a look at the ladder diagram below.

flasher-ladder

OUTPUT is ON when the COMMAND is active, and the timer TM1 is still counting, once TM1 time is elapsed (1 second has passed), OUTPUT will be turn OFF.

The second rung shows how TM1 and TM2 (Cycle timer) are activated. When COMMAND is active both timers start counting, once TM2 preset time of 1.5 seconds is elapsed, it resets both timers using a normally closed contact of TM2.OUT, and the cycle repeats itself.

Now if you want a synchronous flasher, just set TM2 to double the preset value of TM1, any other relation between the two values will give you an asynchronous flasher.

More Timer and Timing Functions

In this article we viewed only three timing functions that can be derived from the standard ON DELAY timer, while still there are more and more than those 7 functions the brochure bragged about.

PULSE timer and PULSE After OFF timer are two types of timing functions that operates based on detecting the transition of COMMAND signal from OFF to ON or vise-versa, regardless of the duration the COMMAND signal has been sustained.

Accumulating timers, as the name indicates, keep accumulating the amount of time the COMMAND has been active, and require a separate RESET input to bring the accumulated value to zero again.

Both above types can be easily implemented by utilizing the ON DELAY timer effectively, and soon separate posts will come about that.