Programmable Logic Controller (PLC) Laboratory
Higher Education As it should be
Chapter 7
Timer and Counter Operations
Prepared by: Hassan Hariri
Modified from: Dr. Ramzi Halabi Page 1
Programmable Logic Controller (PLC) Laboratory
Objectives:
• Be able to perform timer operations.
• Be able to perform counter operations.
• Be able to embed timers and counters in a simple application.
Material:
• PLC Siemens S7-1200 AC/DC/RLY 1214C CPU
• STEP-7 Software Package
• Power Supply 120-240VAC, 50/60 Hz
Description:
1- Timer Operations:
The timers we will be dealing with are
1- TP Timer,
2- TON Timer,
3- TOF Timer,
4- TONR Timer,
5- Preset Timer (PT coil) and
6- Reset Timer (RT coil).
These timers may be used in their “coil” form and may be used in their “box” form, except for
the last two timers that only admit a coil form.
The TP, TON, TOF and TONR timer coils must be the last instruction in a LAD network.
a- Timer Parameters:
• Timer Inputs: (IN)
For the timers TP, TON, and TONR:
Box Representation: 0=Disable timer, 1=Enable timer
Coil Representation: No power flow=Disable timer, Power flow=Enable timer
For the TOF timer:
Box Representation: 0=Enable timer, 1=Disable timer
Coil Representation: No power flow=Enable timer, Power flow=Disable timer
• Timer Preset Time: (PT)
PT (preset time values are stored in the specified IEC_TIMER DB data as signed double integers
that represent milliseconds of time.
Prepared by: Hassan Hariri
Modified from: Dr. Ramzi Halabi Page 2
Programmable Logic Controller (PLC) Laboratory
• Timer Elapsed Time: (ET)
Timer box: ET (elapsed time) box output or ET time value in the timer DB data
Timer coil: you can only address the ET time value in the timer DB data.
TIME data uses the T# identifier and can be entered as a simple time unit (T#200ms or 200) and
as compound time units like T#2s_200ms.
• Reset: (R)
TONR box only:
0=No reset
1= Reset elapsed time and Q bit to 0
• Timer Output: (Q)
Timer box: Q box output or Q bit in the timer DB data
Timer coil: you can only address the Q bit in the timer DB data
b- Timer Types:
• The TP Timer: PULSE TIMER (5 sec)
Prepared by: Hassan Hariri
Modified from: Dr. Ramzi Halabi Page 3
Programmable Logic Controller (PLC) Laboratory
• The TON Timer: ON-DELAY TIMER
• ON-Delay Timer (5s)
Prepared by: Hassan Hariri
Modified from: Dr. Ramzi Halabi Page 4
Programmable Logic Controller (PLC) Laboratory
• The TOF Timer: OFF-DELAY TIMER
• OFF-Delay Timer (5s)
• The TONR Timer: RETENTIVE ON-DELAY TIMER
• Retentive ON-Delay Timer (5s)
Prepared by: Hassan Hariri
Modified from: Dr. Ramzi Halabi Page 5
Programmable Logic Controller (PLC) Laboratory
• ---( PT )---: Load time duration
Prepared by: Hassan Hariri
Modified from: Dr. Ramzi Halabi Page 6
Programmable Logic Controller (PLC) Laboratory
• ---( RT )---: Reset timer:
Prepared by: Hassan Hariri
Modified from: Dr. Ramzi Halabi Page 7
Programmable Logic Controller (PLC) Laboratory
1- Counter Operations:
a- Counter Parameters:
• Counter Up Input (CU)
• Counter Down Input (CD)
• Reset Input (R)
• Load Input (LD)
• Preset Value (PV)
• Output (Q)
• Current Counter Value (CV)
• Status of the Up Counter (QU)
• Status of the Down Counter (QD)
b-Counter Types:
• Count Up (CTU):
Prepared by: Hassan Hariri
Modified from: Dr. Ramzi Halabi Page 8
Programmable Logic Controller (PLC) Laboratory
• Count Down (CTD):
Prepared by: Hassan Hariri
Modified from: Dr. Ramzi Halabi Page 9
Programmable Logic Controller (PLC) Laboratory
• Count Up and Down (CTUD):
Prepared by: Hassan Hariri
Modified from: Dr. Ramzi Halabi Page 10