PLC Timer Programming Examples

PLC Timer Programming Examples

PLC Timer Programming Examples

PLC Timer Programming

A PLC timer is a signal to control and operate a device for a set period of time. We can use the timer to do any certain activities for a set amount of time.

One of the most important and helpful items is a timer. With the help of the PLC programming timer instruction, you can set time-based activities. Each PLC has its own set of timing operations.

The timer instruction is used to give programming logic as well as to determine when the circuit should be turned on or off. It contains two types of contacts: ordinarily open (NO) and typically closed (NC).

Let’s look at how the NO and NC contacts in the input and output timers are represented in LD programming. The coil, box, or rectangular form of the timer output contact is displayed. It is depicted in the box shape in AB and Siemens PLC.

If you want to complete a task or use a device in a specific amount of time, you’ll need to learn how to use timers. For writing the PLC program, you’ll need to master I/O timer commands.

You can specify the PLC timer from milliseconds (ms) to hours (hr) in the Ladder Diagram (LD) PLC programming.

Consider the following PLC Timer Programming Examples: TON, TOF, TP, and TONR are examples of PLC Timers. PLC Timer Instructions and Examples of PLC Timer Logic.

Problem Description

Implementation of IEC timers (TON, TOF, TP &TONR) in S7-1200 PLC using TIA Portal.

Controlling time or signal flow is required in many applications. For example, a valve or a motor may need to be programmed to function for a specific period of time before being switched on after a time interval or a delay.

Problem Diagram

Problem Solution

For this problem, we will use IEC timers (TON, TOF, TP &TONR) in S7-1200 PLC with examples.

In PLCs, there are many different types of timers to choose from. As illustrated in the diagram above,

  • ON delay timer which becomes ON after a particular time delay.
  • Off delay timers are ON for fixed period of time after turning OFF input.
  • Pulse timer switches ON or OFF for fixed period of time.
  • Accumulator timer is which records time interval.

For the purpose of explaining timers, consider the following example of four motors and four SWITCHES. Three motors must be started in three separate methods.

  1. The first motor will start after a 10-second delay.
  2. The second motor will start instantly and then turn off after a 10-second delay.
  3. The third motor will start with a pulse and then turn off after a 10-second delay.
  4. The fourth motor will run for a total of ten seconds.

List of Inputs/Outputs

Inputs List

  • SWITCH 1 : I0.0
  • SWITCH 2 : I0.1
  • SWITCH 3 : I0.2
  • SWITCH 4 : I0.3
  • Reset : I0.4

Outputs List

  • MOTOR 1 :- Q0.0
  • MOTOR 2 :- Q0.1
  • MOTOR 3 :- Q0.2
  • MOTOR 4 :- Q0.3

PLC Ladder diagram for Timers

To postpone the setting of the Q output by the preset duration PT, we can use the Generate-ON-delay or ON delay timer instruction. When the result of the input IN changes from 0 to 1, the instruction is initiated (positive edge).

The ET output of the Timer block can be used to keep track of the current time value. The timer begins at T#0s and finishes when the duration PT value is reached. When the signal status at the IN input switches to 0, the ET output is reset.

To postpone the resetting of the Q output by the defined duration PT, we can use the Generate off-delay or off delay timer command.

When the outcome of a logic operation (RLO) at input IN changes from 0 to 1, the Q output is set (positive signal edge).

At the ET output, we can keep track of the current time value.

The Generate pulse instruction can be used to set the output Q for a specific duration. When the result of the input IN changes from 0 to 1, the instruction is initiated (positive edge). When the instruction begins, programmed time (PT) begins. Even if a fresh positive edge is detected in this timer, the signal state at the output Q remains unchanged as long as the PT time duration is active.

The Time accumulator instruction, often known as an accumulator timer, accumulates time values over a period defined by the programmed time (PT) parameter.

The instruction is executed and the period PT begins when the signal condition at input IN changes from 0 to 1 (positive edge).

Even when the signal state at the IN parameter changes from 1 to 0′′(nega), the Q parameter remains set to 1.

Program Description

In this problem, we will consider S7-1200 PLC and TIA portal software for programming.

Network 1:-

For MOTOR 1 in this network, we used an ON delay timer (create on delay) (Q0.0).

When the SWITCH 1(I0.0) state switches from 0 to 1, the timer instruction is executed, and the MOTOR 1(Q0.0) is activated after a 10-second delay.

Network 2:-

For MOTOR 2 in this network, we utilized an off delay timer (create off delay) (Q0.1).

When the SWITCH 2(I0.1) state switches from 0 to 1, the timer instruction is executed, and the MOTOR 2(Q0.1) is activated instantly.

When the status of SWITCH 2(I0.1) returns to 0, the programmed time (PT) begins, and MOTOR 2(Q0.1) is turned off.

Network 3:-

We used a pulse timer (generate pulse) for MOTOR 3 in this network (Q0.2).

When the SWITCH 3(I0.2) state switches from 0 to 1, the timer instruction is executed, and the MOTOR 3(Q0.2) is activated instantly.

Even if a fresh positive edge is detected, the MOTOR 3(Q0.2status )’s is unaffected as long as the programmed time (PT) is operating.

Network 4:-

We employed an accumulator timer (accumulator time) for MOTOR 4 in this network (Q0.3).

When the SWITCH 4(I0.3) state switches from 0 to 1, the timer instruction is executed, and MOTOR 4(Q0.3) starts after 10 seconds.

Even if the input status turns back to 0, the MOTOR 4(Q0.2) will remain ON. To reset the timer or accumulated time, use the Reset (I0.4).

Runtime Test Cases

Applications of Timer Instruction:

Here are some of the most common timer applications in a PLC automation environment.

  1. For the delay action, use.
  2. It is used to execute or terminate operations based on the user’s demand.
  3. The RTO timer is useful for storing or recording intermediate time values.

Leave a Reply

Your email address will not be published.