PLC Program for IEC timers ( TON, TOF, TP &TONR ) used in S7-1200

0
135

This is PLC Program for IEC timers (TON, TOF, TP &TONR) used in S7-1200 using TIA Portal.

Problem Description

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

In many applications there is a requirement to control time or signal flow. For example, a valve, a motor might need to be controlled to operate for a particular interval of time, switched ON after some time interval or after some delay.

Problem Diagram

Problem Solution

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

There are number of different forms of timers that can be found in PLCs. As shown in above diagram,

  • 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.

Here consider example of four motors and four SWITCHES for explanation of timers. We need to start three motors in different ways.

  1. First motor will start after 10s delay,
  2. second motor start immediately and off after 10s delay and
  3. third motor will start with pulse and off with 10s delay.
  4. Fourth motor will run for total 10s.

Program

Here is PLC program to implement IEC timers (TON, TOF, TP &TONR) in S7-1200 PLC.

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:-

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

Ladder diagram for IEC (TON, TOF, TP &TONR) in S7-1200 PLC.

We can use the Generate-ON-delay or ON delay timer instruction to delay setting of the Q output by the programmed duration PT. The instruction is started when the result of the input IN changes from 0 to 1 (positive edge).

You can monitor the current time value at the ET output of the Timer block. The timer value starts at T#0s and ends when the value of duration PT is reached. The ET output is reset as soon as the signal state at the IN input changes to 0.

PLC Program for IEC timers

We can use the Generate off-delay or off delay timer instruction to delay resetting of the Q output by the programmed duration PT. The Q output is set when the result of logic operation (RLO) at input IN changes from 0 to 1 (positive signal edge). We can monitor the current time value at the ET output.

We can use the Generate pulse instruction to set the output Q for a programmed duration. The instruction is started when the result of the input IN changes from 0 to 1 (positive edge). The programmed time (PT) begins when the instruction starts. In this timer even if a new positive edge is detected, the signal state at the output Q is not affected as long as the PT time duration is running.

The Time accumulator instruction or accumulator timer is used to accumulate time values within a period set by the programmed time (PT) parameter. When the signal state at input IN changes from 0 to 1 (positive edge), the instruction is executed and the duration PT starts. In this case the Q parameter remains set to 1, even when the signal state at the IN parameter changes from 1 to 0″(negative edge). The R input resets the outputs Q.

Program Description

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

Network 1 :- In this network we have used ON delay timer (generate on delay) for MOTOR 1(Q0.0).When the status of the SWITCH 1(I0.0) changes from 0 to 1 the timer instruction will be executed and it will activate the MOTOR 1(Q0.0) after 10s delay.

Network 2 :- In this network we have used off delay timer (generate off delay) for MOTOR 2(Q0.1).When the status of the SWITCH 2(I0.1) changes from 0 to 1 the timer instruction will be executed and it will activate the MOTOR 2(Q0.1) immediately. When the SWITCH 2(I0.1) status changes back to 0 then programmed time (PT) will start and after time MOTOR 2(Q0.1) will be OFF.

Network 3 :- In this network we have used pulse timer (generate pulse) for MOTOR 3(Q0.2).When the status of the SWITCH 3(I0.2) changes from 0 to 1 the timer instruction will be executed and it will activate the MOTOR 3(Q0.2) immediately. In this case even new positive edge is detected, the status of the MOTOR 3(Q0.2) is not affected as long as programmed time (PT) is running.

Network 4 :- In this network we have used accumulator timer (accumulator time) for MOTOR 4(Q0.3).When the status of the SWITCH 4(I0.3) changes from 0 to 1 the timer instruction will be executed and MOTOR 4(Q0.3) will start after 10s. The MOTOR 4(Q0.2) will remain ON, even when the input status changes back to 0.The Reset (I0.4) is necessary to reset the timer or accumulated time.

Runtime Test Cases

IEC timers used in S7-1200 PLC

Article by
Bhavesh Diyodara

LEAVE A REPLY

Please enter your comment!
Please enter your name here