Professional Documents
Culture Documents
9 Timer functions
2.9.1 On-delay timer
The most commonly used device in relay or PLC systems, after switches and relays, is the
timer. The most common timing function is TIME DELAY ON. The simplest instruction
producing this function in the SIEMENS S7 PLC is the On-Delay Timer Coil.
I0.0
T2
timer No
K1T
SD
S5T#2s
T2
Q1.0
K1T
2s
Electromechanical relay
equivalent circuit
If the signal state of input I0.0changes from 0 to 1 (positive edge) timer T2 is started.
If the specified time elapses and the SS of I0.0 is still 1, output Q4.0 changes from 0
to 1. If I0.0 changes from 1 to 0, the timer is stopped.
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz
I0.0
0
time
T2
1
0
t
t = programmed time value (delay)
The output signal changes to 1 only when the programmed time has elapsed
and the input signal is still 1.
Example
Design a PLC-based system in which two lamps, A and B, are
controlled in the following manner. When the switch is turned on,
lamp A is lit immediately and, after 10 s lamp B is lit. Both lamps are
switched off when the switch is open.
I1.0
Q1.0
Lamp A
Q1.0
I1.0 Q1.0
T1
SD
Q1.1
Timer
S5T#10s
T1
PLC
Q1.1
Lamp B
PLC connections
Ladder Logic Program
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz
The On-Delay function can be also provided by the On-Delay Timer instruction
Timer designation
Start input
Start input
I:0
Q1.1
Q1.0
2
T4:0
O:0
DN
15
SIEMENS
Timer Done
R = Reset input
TV = Time Value input/Preset value
AB
Q = Output
BI, BCD = Remaining time value
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz
The Reset (R) input resets the time base to zero, if it changes from 0 to 1.
timer starts
timer starts
Reset
S
R
Q
delay
delay
The reset function is usually used to re-establish the conditions at the start
of a program cycle after the previous cycle has been completed.
T5
S_OFFDT
T5
S5T#2s
Q4.0
S5T#1h_15m
SIEMENS
timer starts
Off-Delay Timer
S or I0.0
Q or T5
Delay
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz
Delay
6
Example
Lubrication for main motor bearings is required for 30 s after the
supply of the motor is switched off. The main motor contactor is
controlled by a PLC. Write a program for controlling the motor of the
lubricating pump.
T1
Q0
Off-Delay
Main Motor
Contactor
30 s
Q0
T1
Q1
PLC
Q1
Lubricating Pump
Motor Contactor
PLC connections
Generic
symbol!
(Requires
explanation)
In general, the same timer function can be achieved using different timers.
The resultant program, however, may be more difficult to understand.
The previous problem solved using the On-Delay timer:
Main
Motor ON
T1
Q0
On-Delay
Timer starts
Main motor
(Q0)
30 s
Timer input
Q0
T1
On-Delay
Q1
Timer output
(T1)
Q1
Pump (Q1)
Q1 stays latched
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz
Retentive Timer On-Delay: As long as the input is 1 the timer increments its
accumulator until the preset value is reached.
input
t1
t2
t1 + t2 + t3 = preset value
Output
(DN)
t3
AB
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz
2.10 Counters
2.10.1 Up Counter
Acc. value
Preset value
N+1
N
initial acc.
value
AB
time
DN
1
0
10
Acc. value
Preset
value, eg. 2
DN 1
AB
CV
C#<value>
count value
PV
SIEMENS
S: 01 sets the count value (accumulated value)
with the preset value PV
R: 01 sets the count value to 0 (resets the
counter)
S
Q
11
Example
A typical application of counters is monitoring of the number of parts on a
conveyor. The motor of a conveyor is to stop automatically after 20 packages have
been delivered to the temporary storage area. The Storage Full lamp is to be lit at
that instant. The packages travelling on the conveyor break the beam of the
photoelectric barrier so that a pulse is generated for each passing package. Develop
a PLC program for the system.
STORAGE FULL
Photoelectric barrier
ON
OFF
START
Temporary storage
12
System component
Address
Push-button ON (N/O)
Push-button OFF (N/C)
Push-button START (N/O)
Photoelectric barrier
Motor contactor coil
Lamp STORAGE FULL
Network title
I0.0
I0.1
I0.0
I0.1
I0.2
I0.3
Q4.0
Q4.1
M0.0
Network comment
Memory Bit ( a coil without an
associated PLC output terminal)
M0.0
13
I0.2
M0.0
Q4.0
Network 3: Counter
Counter C1 count down at each change of the photoelectric barrier signal from 0
to 1. Input I0.3 is 1 when the barrier is broken by a package. Pushbutton START
sets the counter with the value of 20.
C1
I0.3
I0.2
C#20
I0.2
SIEMENS
EEET 2204 Industrial Automation by Dr Peter Graszkiewicz
14
C1
Q4.0
R
I0.1
C1
M0.0
Q4.1
15
M0 System ON
I1
O1
C1
R
I1
M0
Motor OFF
I2
O1 Motor ON
C1
M0
O2
C1
I3
Count down
from 20 to 0
STORAGE FULL
indicator
Done
01
Reset to 20
16
2.11 Flowcharting
A flowchart is a pictorial representation of program logic. It can help to develop a
ladder logic program, in particular, for large processes.
The following flowchart symbols will be used:
?
Yes
17
A flowchart for the conveyor counter example in section 2.10.2 can look as shown
below:
The motor of a conveyor is to stop automatically after
20 packages have been delivered to the temporary
storage area. The Storage Full lamp is to be lit at that
instant. The packages travelling on the conveyor break
the beam of the photoelectric barrier so that a pulse is
generated for each passing package.
START
Operator turns
system on
Operator starts
conveyor
Have 20 packages
been counted?
Yes
No
Conveyor stops
and lamp is lit
18