Recently, I have been reading some PLC manuals, and I noticed a supplier boasting that his smallest PLC provides 7 types of timers and timing functions, suggesting that this is a factor that distinguishes his PLC from other brands. Although these words sound tempting, from a practical point of view, these 7 types have no real value, except for very lazy PLC programmers.
It’s easy to assume that all control applications contain at least one timer. Don’t get me wrong, timing and sequencing are both vital components of any control system. But in my opinion, dancing around the timer “type” is just misleading.
In fact, by correctly using the most basic timer type ON DELAY, you can derive any type of timer or timing function. Here, we will show examples of three types of timers (or timing functions) derived:
- Turn off the delay timer
- On +OFF delay timer
Before the demonstration, let’s take a look at how the ON DELAY timer works.
1. Master of all timers! On delay
Compared with ordinary relays, a relay is a device that immediately switches its output (ON or OFF) as the input state changes.
On the other hand, ON DELAY Timer is similar to a relay, except that it “turns on the output after a certain delay”, which is its name, ON DELAY. A relay output can be turned off immediately, as with a normal relay.
In the ladder diagram, the use of the ON DELAY timer block is very simple. The timer block receives a command. After the preset time has passed, the timer output contact (TM1.OUT) is switched and the output switch is turned on or off.
As shown in the above ladder diagram, in this article, we will use the term COMMAND to denote the condition for starting the timing function, the term OUTPUT to denote the result of the timing function, and TON DELAY for the ON DELAY timer block.
2. Off delay timer
An OFF DELAY Timer is similar to a relay, except that it “turns off the output after a certain delay”, which is its name, OFF DELAY. Turning on the output is similar to a normal relay, it happens immediately.
The following is a ladder diagram showing how to use the ON DELAY timer to derive the above-mentioned OFF DELAY timing function.
The first rung is very simple; once the command is activated, OUTPUT will be opened immediately, and OUTPUT is self-locking, so when the command is no longer activated, OUTPUT remains on until the output of the ON DELAY timer “TM1”. “Output” is active, it will cut off the output line, so that it loses its vitality.
The second rung is the timer rung; it just shows the conditions that must exist before the timer starts to calculate the 3-second preset value. COMMAND must be inactive and OUTPUT must be active. This combination guarantees that the timer will only start after COMMAND has been turned on and then turned off again.
Have you tested it on the simulator? Very effective.
3. On/ off delay timer
As its name suggests, it is a combination of ON DELAY and OFF DELAY timers, so when a command is received, it introduces a delay before turning OUTPUT on, and turning OUTPUT off when the command disappears also introduces a delay.
This requires two timers:
- Calculate the delay before turning on the output (TM1)
- Calculate the delay before turning off the output (TM2)
Note: The above diagram can be combined into one step, but not all brands of PLC software allow you to do this, so for clarity and versatility, let us separate the steps.
This ladder follows the same method of demonstrating the OFF DELAY timing function, adding a 2 second ON DELAY timer to introduce a delay before the command turns OUTPUT ON.
4. Flash time function
This is very interesting in the PLC manual I mentioned at the beginning. The PLC supplier thinks that he has two different types of timers, synchronous flasher (ON time is equal to OFF time) and asynchronous flasher (ON and OFF time are Different), how boring.
Let me show you how to create a universal blinking function that works synchronously or asynchronously.
To program any two-step, time-based loop operation, two cycles (two preset values for two timers) need to be defined:
- Opening period
What you want to do is to turn on the flasher after COMMAND is activated for 1 second (TM1), and then turn it off for 0.5 seconds, so that the total CYCLE cycle is 1.5 seconds (TM2), look at the ladder diagram below.
When COMMAND is activated, OUTPUT is ON and timer TM1 is still counting. Once TM1 time has passed (1 second has passed), OUTPUT will be closed.
The second rung shows how to activate TM1 and TM2 (cycle timer). When COMMAND is activated, both timers start counting. Once the preset time of TM2 has passed 1.5 seconds, it uses a normally closed contact of TM2 to reset the two timers. Then it goes back and forth.
Now, if you want a synchronous flasher, just set TM2 to twice the preset value of TM1, and any other relationship between these two values will give you an asynchronous flasher.
More timers and timing functions
In this article, we have only seen three timing functions that can be derived from the standard ON DELAY timer, and there are still more functions than the 7 boasted in the brochure.
PULSE timer and PULSE After OFF timer are two timing functions. They run based on detecting the transition of the command signal from OFF to on or vice versa, regardless of the duration of the command signal.
The accumulator timer, as its name suggests, continuously accumulates the amount of time that COMMAND is active and requires a separate RESET input to bring the accumulated value to zero again.
Both of the above types can be easily implemented by effectively using the ON DELAY timer, and a separate post will appear soon.