engg3490 plc l4
TRANSCRIPT
-
7/31/2019 Engg3490 Plc l4
1/57
ENGG3490-PLC
PLCs Ref. [3];
1. Programming Timers
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D.Petruzella, McGraw-Hill
1
2. rogramm ng oun ers
There are very few industrial control systems that do not
need at least one or two timed functions. They are used to
activate or de-activate a device after a preset interval of
Timers
.
Time delay relays and solid-state timers are used to provide a time
delay. They may have displays, pots or other means of operator
interface for time settings and electromechanical or solid state
outputs.
Solid-State
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Control lers By F. D. Petruzel la , McGraw-Hil l 2
Relay Timer
-
7/31/2019 Engg3490 Plc l4
2/57
On-Delay Timing Relay
Operating coil
NO Nontimed contacts are
controlled directly by
contacts
NC
e mer co , as n a
general-purpose
control relay.
When the coil is
energized, the timed
contacts are prevented
from opening or closing
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Control lers By F. D. Petruzel la , McGraw-Hil l 3
Time control
contacts
NC
Time adjustment
until the time delay
period has elapsed.
However, when the coil isde-energized, the timed
contacts return
instantaneously to their
normal state.
Timed Contact Symbols
On-Delay Symbols
Normally open, timed
closed contact (NOTC)
Normally closed, timed
open contact (NCTO)
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Control lers By F. D. Petruzel la , McGraw-Hil l 4
relay coil is de-energized
When relay is energized,
there is a time delay in
closing
relay coil is de-energized
When relay is energized,
there is a time delay in
opening
-
7/31/2019 Engg3490 Plc l4
3/57
Normall o en timed
Timed Contact Symbols
Off Delay Symbols
Normall closed timed
open contacts (NOTO).
Contact is normally
open when relay coil
is de-energized.
When relay coil is
closed contacts (NCTC).
Contact is normally
closed when relay coil
is de-energized.
When relay coil is
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Control lers By F. D. Petruzel la , McGraw-Hil l 5
energ ze , con ac c oses
instantly.
When relay coil is de-
energized, there is a time
delay before the contact
opens.
energ ze , con ac opens
instantly.
When relay coil is de-
energized, there is a time
delay before the contact
closes.
On-Delay Relay Timer Circuit (NOTC Contact)
L1 L2S1
Sequence of operation
S1 open, TD de-energized,
L1
10 s
, .
After 10 s, TD1 closes, L1 is
S1 closes, TD energizes,
timing period starts,
TD1 still open, L1 is still off.
10 s
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Control lers By F. D. Petruzel la , McGraw-Hil l 6
switched on.
S1 is opened, TD de-
energizes, TD1 opens
instantly, L1 is switched off.
OFF
ONInput
Output
Timing Diagram
-
7/31/2019 Engg3490 Plc l4
4/57
On-Delay Relay Timer Circuit (NCTO Contact)
S1 open, TD de-energized,
Sequence of operation
L1 L2
S1
L1 L2
, .L1
10 s
After 10 s, TD1 opens,
S1 closes, TD energizes,
timing period starts, TD1
is still closed, L1 is still on.
10 s
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Control lers By F. D. Petruzel la , McGraw-Hil l 7
L1 is switched off.
S1 is opened, TD de-energizes,
TD1 closes instantly, L1 is
switched on.
On
Off
Input
Output
Timing Diagram
Off-Delay Relay Timer Circuit (NOTO Contact)
L1 L2
S1 Sequence of operation
S1 open, TD de-energized,
L1
, .
S1 closes, TD energizes,
TD1 closes instantly,
L1 is switched on.
S1 is opened, TD de-energizes,
10 s
10 s
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Control lers By F. D. Petruzel la , McGraw-Hil l 8
,
still closed, L1 is still on.
After 10 s, TD1 opens, L1 is
switched off.
Input
OutputOff
On
Timing Diagram
-
7/31/2019 Engg3490 Plc l4
5/57
Off-Delay Relay Timer Circuit (NCTC Contact)
L1 L2
S1 Sequence of operation
S1 open, TD de-energized,
L1
, .
S1 closes, TD energizes,
TD1 opens instantly,
L1 is switched off.
S1 is opened,
-
10 s
10 s
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Control lers By F. D. Petruzel la , McGraw-Hil l 9
period starts, TD1 is still
open, L1 is still off.
After 10 s, TD1 closes,
L1 is switched on.
Input
OutputOn
Off
Timing Diagram
Programmed Timer Instructions
PLC timers are output instructions that provide the
same functions as timing relays and solid state timers.
Some advantages of PLC timers:
their settings can be altered easily
the number of PLC timers used
can be increased or decreased by
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 10
programming changes withoutwiring changes
timer accuracy and repeatability
are extremely high
-
7/31/2019 Engg3490 Plc l4
6/57
RSLogic Timer Commands
TON
Command Name Description
TON Timer On-Delay Counts time base
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 11
instruction is true
RSLogic Timer Commands
TOF
Command Name Description
TOF Timer Off-Delay Counts time base
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 12
instruction is false
-
7/31/2019 Engg3490 Plc l4
7/57
RSLogic Timer Commands
Timer/Counter
RTO RES
Command Name Description
RTO Retentive TimerON
Counts time base
intervals when the
instruction is true and
retains the accumulated
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 13
value when the
instruction goes "false" or
when power cycle occurs
RES ResetWhen this instruction is
"true" it resets the count
of the RTO counter
Quantities Associated with the Timer Instruction
Preset Time Represents the time duration of the timing
circuit. For example, if a time delay of 10 s is required,
the timer will have a preset of 10 s.
Accumulated Time Represents the amount of time that
has elapsed from the moment the timing coil became
energized.
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 14
several different time bases: 1 s, 0.1 s, and 0.01 s are
typical time bases. For example, if you enter 0.1 for the
time base and 50 for the preset time the timer would
have a 5 s delay (50 x 0.1 s = 5 s).
-
7/31/2019 Engg3490 Plc l4
8/57
Coil-Formatted Timer Instruction
The timer assigned
an address
The type of timer
Contact determines
rung continuity
TON
s spec e
Preset value PR:YYY
Time base 0.1 s
Accumulated value AC:000
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 15
When the timer rung has logic continuity, the timer's
accumulated value increases. When accumulated value equals
the preset value, the output is energized and and the timedoutput contact associated with the output is closed. The timed
contact can be used as many times as you wish throughout the
program as a NO or NC contact.
Generic Block-Formatted Timer Instruction
Timers are most often represented by boxes in a ladder
logic.
Control line controls the actual timing operation of the timer.
Preset time
Time base
Retentive timer block
Whenever this line is true the timer will time.
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 16
Reset line resets the the timer's accumulated value to zero.
-
7/31/2019 Engg3490 Plc l4
9/57
Generic Block-Formatted Timer Instruction
Timers are most often represented by boxes in a ladder
logic.
Preset time
Time base
Retentive timer block
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 17
The timer continuously compares its accumulated time with itspreset time. Its output is logic 0 as long as the accumulated time is
less than the preset time. When the two become equal the output
changes to logic 1.
On-Delay Timer Instruction
Theon-delay timer operates
so that, when the rung
containing the timer is true,TimerInput
the timer time-out period
commences.
Rung conditionFalse
TrueTimer Sequence
The timed output
becomes true
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 18
Timed periodOn delay
time duration
Timed output bitFalse
OFF
True
ON
timer rung becomes
true; hence the timer
is said to have an on
delay.
-
7/31/2019 Engg3490 Plc l4
10/57
-
7/31/2019 Engg3490 Plc l4
11/57
Allen-Bradley On-Delay Timer Instruction
The Timer-Timing (TT) bit is true whenever the
accumulated value of the timer is changing, which
means the timer is timing.
TIMER ON DELAY
TON
Timer T4:0
Preset 50
Accumulated 10
EN
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 21
TT
T4:0 Timer-Timing bit true
Allen-Bradley On-Delay Timer Instruction
The Done-Bit (DN) changes state whenever the
accumulated value reaches the preset value. Its
state depends on the type of timer being used.
TIMER ON DELAY
TON
Timer T4:0
Preset 50
Accumulated 10
EN
DN
50
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 22
DN
T4:0 Done-bit changes state
-
7/31/2019 Engg3490 Plc l4
12/571
Allen-Bradley On-Delay Timer Instruction
The preset value (PRE) wordis the set point of the
timer, that is, the value up to which the timer will
time.
The accumulated value (ACC) wordis the value that
increments as the timer is timing. The accumulated
value will stop incrementing when its value reaches
the preset value.
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 23
TIMER TABLE
T4:0
/EN /TT /DN .PRE .ACC
0 0 0 0 0
Allen-Bradley On-Delay Timer Instruction
TON
TIMER ON DELAY
The information to be entered includes:
DN
Time base 1.0
Preset 15
Accumulated 0
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 24
Time base which is expressed in seconds.
Preset value which is the length of the time delay.
Accumulated value which is normally entered as 0.
-
7/31/2019 Engg3490 Plc l4
13/571
On-Delay Timer Program
Ladder Logic Program
L1 L2
Input A TON
Input A
T4:0
T4:0
EN
Timer T4:0
Time base 1.0
Preset 10
Accumulated 0
EN
DN
Output B
Output B
Output C
Output COutput D
G
R
Y
10
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 25
T4:0
TT
DN
Output D
On-Delay Timer Program
Timing Diagram
Input condition A
On
Off
Timer-enable bitn
Off
Timer-timing bitOn
Off
Timer-done bitOn
4 s 10 s
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 26
Timer accumulated
value
0
-
7/31/2019 Engg3490 Plc l4
14/571
On-Delay Timer Program
Timers are 3-word elements
0
1
2
EN TT DN Internal use
Preset value PRE
Accumulated value ACC
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 27
Word 0 is the control word
Word 1 stores the preset value
Word 2 stores the accumulated value
On-Delay Timer With Instantaneous Output
Relay Ladder Schematic Diagram
Sto Start
1TD
-
1TD
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 28
M(instantaneous
contact)
1TD-2
(5 s)
(timed contact)
-
7/31/2019 Engg3490 Plc l4
15/571
On-Delay Timer With Instantaneous Output
Programmed Circuit
Ladder logic program
Motor
Motor
M
Internal
relay
Internal
relay
Stop
Stop
Start
Start
M
L1 L2
Inputs Output
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 29
Timer
PR: 5
TB: 1 s Output
line
Start-Up Warning Signal Circuit
Relay Ladder Schematic Diagram
L1 L2Start-up
PB1Reset
PB2 CR1
CR1-1
1TD
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 30
CR1-2
1TD-1
(10 s)
CR1-3
Horn
-
7/31/2019 Engg3490 Plc l4
16/571
InputsLadder logic program
Programmed Circuit
Start-Up Warning Signal Circuit
TON
TIMER ON DELAY
Timer T4:0
Time base 1.0
Preset 10
Accumulated 0
Output
Horn
Horn
Start-up
Reset
PB1
PB1
PB2
PB2
EN
DNT4:0
EN10
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 31
DN
:
EN
:
Timed Closed Solenoid Valve Program
Input
L1
Ladder logic programOutput
L2
w c
SW_1
_
Valve
Valve
EN
DN
timer_1.dn
Timer On Delay
Timer timer_1
Preset 12000
Accumulated 012000
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 32
-
7/31/2019 Engg3490 Plc l4
17/571
Automatic Sequential Control System
Relay Ladder
Schematic
Diagram
L1 L2Stop
PB1
Start
PB2 Lube oil
pump motorOL
M1
M1-1
PS1
(lube oil
Main drive
motor
M2
OL
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 33
1TD
1TD-1
(15 s)
Feed
motor
OL
M3
Automatic Sequential Control System
Programmed Circuit
Inputs Outputs
Ladder logic program
OL
M1
PB1
PB1 PB2
OL
OL
M1
M2M2
M3
TON
TIMER ON DELAY
PB2
PS1 PS1
M1
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 34
M3
Timer T4:0Time base 1.0
Preset 15
Accumulated 0
DN
T4:0
DN
15
-
7/31/2019 Engg3490 Plc l4
18/571
Off-Delay Programmed Timer
Theoff-delay timer (TOF) operation will keep the output
energized for a period after the rung containing the timer
has gone false.
EN
DN
TOF
TIMER OFF DELAY
TIMER T4:3
Time base 1.0
I:1.0/0
I:1.0/0
O:2.0/1 PL
L1 L2Input Output
Ladder logic program
S1
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 35
Preset 15
Accumulated 0
O:2.0/1T4:3/DN
15
Off-Delay Programmed Timer
Timing Diagram
True
Input condition
S1 False
Timed period
Off delay
timed duration
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 36
Timed output
O:2.0/1
True (logic 1)
False (logic 0)
Preset value = accumulated value
-
7/31/2019 Engg3490 Plc l4
19/571
L1
Off-Delay Timer Used To Switch Motors Off
InputL2
OutputLadder logic program
5000
10000
15000
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 37
Pneumatic Off-Delay Timer
L1 L2
Relay Ladder
Schematic
Diagram
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 38
-
7/31/2019 Engg3490 Plc l4
20/572
Programmed Pneumatic Off-Delay Timer
Equivalent Programmed Circuit
L1 L2
Input OutputsLadder logic program
5
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 39
Fluid Pumping Process
When the pump start button is pressed, the pump starts. The
Operation
Before starting, PS1 must be closed.
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 40
When the stop button is pushed, the pump stops.
PS2 and PS3 must be closed for 5 s after the pump starts. If
either PS2 or PS3 opens, the pump will shut off and will not not
be able to start again for another 14 s.
-
7/31/2019 Engg3490 Plc l4
21/572
Fluid Pumping Process Program
Inputs Output
Ladder logic program
L1 L2
50
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 41
Retentive Timer
Aretentive timer accumulates time whenever the device
receives power, and maintains the current time should
power be removed from the device. Once the device
,
the device change state. The retentive timer must be
intentionally reset with a separate signal for the
accumulated time to be reset.
Electromechnical Retentive Timer
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 42
Cam operated
contact
Motor-driven
cam
Once power is applied, the motorstarts turning the cam. The
positioning of the lobes determines
the time it takes to activate the
contacts. If power is removed from
the motor, the shaft stops butdoes
not reset.
-
7/31/2019 Engg3490 Plc l4
22/572
Retentive On-Delay Timer Program
The PLC-programmed RETENTIVE ON-DELAY timer
(RTO) operates in the same way as the nonretentive on-delay timer (TON), with one major exception. There is a
.
Unlike the TON, the RTO
will hold its accumulated
value when the timer rung
goes false and will continue
timing where it left off when
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 43
the timer rung goes true
again. This timer must be
accompanied by a timer reset
(RES) instruction to reset the
accumulated value of the
timer to zero.
Same address
Retentive On-Delay Timer Program
390
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 44
-
7/31/2019 Engg3490 Plc l4
23/572
Retentive On-Delay Timing Chart
Enable bit is reset when
input pushbutton PB1 is
opened
=Accum value retained
when rung goes false
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 45
When reset PB2 is closed,
the T4:2/DN bit is reset to
0. Accumulated value is
reset and held at zero until
the reset pushbutton is
opened.
Retentive On-delay Alarm Program
L1
L2Ladder logic program
600000
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 46
The purpose of the RTO timer is to detect whenever a piping
system has sustained a cumulative overpressure condition of 60 s.
At that point, a horn is sounded automatically. You can silence the
alarm by switching the key switch to the rest position.
-
7/31/2019 Engg3490 Plc l4
24/572
Bearing Lubrication
Program
Sequence Of Operation
To start the machine, the operator turns SW on.
Before the motor shaft starts to turn, the bearings are supplied
with oil by the pump for 10 s.
The bearings also receive oil when the machine is running.
When the operator turns SW off to stop the machine, the oil
pump continues to supply oil for 15 s.
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 47
A retentive timer is used to track the total running time of the
pump. When the total running time is 3 h, the motor is shut down
and a pilot light is turned on to indicate that the filter and oilneed to be changed.
A reset button is provided to reset the process after the filter and
oil have been changed.
Bearing Lubrication Program
100
15
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 48
10800
-
7/31/2019 Engg3490 Plc l4
25/572
Cascading Timers
The programming of two or more timers together is
calledcascading. Timers may be interconnected, orcascaded to satisfy any required control logic.
Three motors started
automaticall in
Relay Schematic
Diagram
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 49
sequence with a 20-s
time delay betweeneach motor startup.
Equivalent Time-Delayed Motor-Starting Program
20000
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 50
20000
-
7/31/2019 Engg3490 Plc l4
26/572
Annunciator Flasher Circuit
Two timers can be interconnected to form an oscillator
circuit. The oscillator logic is basically a timing circuit
programmed to generate periodic output pulses of any
duration. They can be used as part of an annunciator
system to indicate an alarm condition.
The oscillator circuit output
is programmed in series with
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 51
the alarm condition. If the
alarm condition is true, the
appropriate output
indicating light will flash.
Annunciator Flasher Circuit
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 52
-
7/31/2019 Engg3490 Plc l4
27/572
Cascading of Timers for Longer Time Delays
30000
12000
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 53
Control of Traffic Lights in One Direction
A typical application for PLC timers is the control of
traffic lights.
Control of Traffic in One Direction
Sequence of Operation
Green
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 54
30 s 5 s25 s
-
7/31/2019 Engg3490 Plc l4
28/572
Control of Traffic Lights in One Direction
30
25
5
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 55
ENGG3490-WEEK9-11
PLCs Ref. [3];
1. Programming Timers
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D.Petruzella, McGraw-Hill
56
2. rogramm ng oun ers
-
7/31/2019 Engg3490 Plc l4
29/572
Counters
Common applications of counters include keeping trackof the number of items moving past a given point, and
determining the number of times a given action occurs.
A preset counter can control an
external circuit when its
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 57
coun e o a ma c es e
user-entered preset limits.
Mechanical Counters
Programmed counters can serve
the same functions as mechanical
counters.
Every time the actuating lever is moved
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 58
over e coun er a s one num er,while the actuating lever returns
automatically to its original position.
Resetting to zero is done with a
pushbutton located on the side of the
unit.
-
7/31/2019 Engg3490 Plc l4
30/57
-
7/31/2019 Engg3490 Plc l4
31/573
Coil-Formatted Counter And Reset Instruction
Same address
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 61Resets counter when true
Block-Formatted Counter Instruction
Type of
counter
Preset value
Count lineOutput
line
Accumulated
valueReset line
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 62
input signal. The counter will either increment or decrement
whenever the count input transfers from an "off" state to an
"on" state. The counter will not operate on the trailing edge,
or on-to-off transition of the input condition.
-
7/31/2019 Engg3490 Plc l4
32/573
Counter Counting Sequence
PLC counters are normally retentive. Whatever
count was contained in the counter at the time of a
processor shutdown will be restored to the counter on
power-up. The counter may be reset, however, if the
reset condition is activated at the time of power
restoration.
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 63
PLC counters can be designed to count up to a presetvalue or to count down to a preset value.
The up-counter is incremented by 1 each time the rung
containing the counter is energized.
Counter Counting Sequence
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 64
equal to or greater than the preset value, at which time an
output will be produced.
-
7/31/2019 Engg3490 Plc l4
33/573
The down-counter decrements by 1 each time the rung
containing the counter is energized.
Counter Counting Sequence
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 65
A counter reset is always provided to cause the counteraccumulated value to be reset to a predetermined value.
Simple Up-counter Program
7
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 66
-
7/31/2019 Engg3490 Plc l4
34/573
Up-counter Program Timing Diagram
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 67
C5 Counter Data File
Each counter address is made of a 3-word element
Bit 0-9: Internal Use
-
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 68
.
Bit 11: UN - Underflow bit.
Bit 12: OV - Overflow bit.
Bit 13: DN - Done
Bit 14: CD - Count down is enabled.
Bit 15: CU - Count up is enabled.
-
7/31/2019 Engg3490 Plc l4
35/573
C5 Counter Data File
Each counter address is made of a 3-word element
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 69
pec es e va ue, w c e coun er mus reac e ore e con ro er
sets the done bit. When the accumulated value becomes equal to or
greater than the preset value, the done status bit is set. You can use thisbit to control an output device.
C5 Counter Data File
Each counter address is made of a 3-word element
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 70
This is the number of times of false to true transitions that have occurredsince the counter was last reset.
-
7/31/2019 Engg3490 Plc l4
36/573
PLC-5 And SLC 500 Count-Up Counter Instruction
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 71
ControlLogix Count-Up Counter Instruction
The counter address in the PLC-5 and SLC 500 is a data table
address, whereas in the ControlLogix it is a predefined
structure of the data type.
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 72
In the PLC-5 and SLC 500, the max value for the preset and
accumulated values is 32,767 and the min value is 32,768; for
the ControlLogix controller the max value is 2,147,438,647 and
the min value is 2,147,438,648.
-
7/31/2019 Engg3490 Plc l4
37/573
RSLogic Counter Commands
Command Name Description
CTU Count-UpIncrements the accumulated
value at each false-to-true
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 73
accumulated value when
power cycle occurs
RSLogic Counter Commands
Command Name Description
CTD Count-DownDecrements the accumulated
value at each false-to-true
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 74
accumulated value when
power cycle occurs
-
7/31/2019 Engg3490 Plc l4
38/573
Parts Counting Program
Counter C5:2 counts thetotal number of parts coming
off an assembl line for final
packaging
Each package must contain 10 parts
When 10 parts are detected, counter C5:1 sets bit B3/1 to
initiate the box closin se uence
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 75
Counter C5:3 counts the total number of packages filled per day
A pushbutton is used to restart the total part and package count
from zero daily
Parts Counting Program
9100
91010
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 76
1
-
7/31/2019 Engg3490 Plc l4
39/573
One-Shot, Or Transitional, Contact Program
The transitional or one shot contact program can be used to
automatically clear or reset a counter. The program is designedto generate an output pulse that, when triggered, goes on for
the duration of one ro ram scan and then oes off.
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 77
One-Shot, Or Transitional, Contact Program
The transitional or one shot contact program can be used to
automatically clear or reset a counter. The program is designed
to generate an output pulse that, when triggered, goes on for
the duration of one ro ram scan and then oes off.
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 78
The one-shot can be
triggered from a
momentary signal, or
one that comes on and
stays on for some time.
-
7/31/2019 Engg3490 Plc l4
40/574
Types Of Transitional Contacts
Off-To-On Transitional Contact
OnIs programmed to
provide a one-shot
Symbol
Off
Off
On
One
scan
referenced trigger
signal makes a
positive (off-to-on)
transition
On-To-Off Transitional Contact
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 79
Symbol Onescan
Off
Off
On
On
Is programmed to
provide a one-shot
pulse when the
referenced trigger
signal makes a negative
(on-to-off) transition
Proximity
switch
Conveyor Motor Circuit That Uses A
Programmed One-Shot Reset Circuit
Sequential Task:
Case
Conveyor motorCount reset
button
Cases move pass the proximity
switch and increment the
counter's accumulated value
The start button is pressed
to start the conveyor motor
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 80
tart top stat on
After a count of 50, the conveyor motor stops automatically
and the counter's accumulated value is reset to zero
The conveyor motor can be stopped or started manually at
anytime without loss of the accumulated count
-
7/31/2019 Engg3490 Plc l4
41/574
Conveyor Motor Circuit That Uses A
Programmed One-Shot Reset Circuit
50
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 81
One-Shot Rising (OSR) Instruction
Triggers a one-time event.
The OSR instruction is a retentive input instruction
that triggers an event to occur only one time. Use the
OSR instruction when an event must start based on
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 82
.
When the input instruction goes from false to true, the
OSR instruction conditions the rung so that the output
goes true for one scan. The output goes false and
remains false for successive scans until the input makes
another false to true transition.
-
7/31/2019 Engg3490 Plc l4
42/574
Alarm Monitor Program
The alarm is triggered by the closing of liquid level switch
LS1
The light will flash whenever the alarm condition is triggered
and has not been acknowledged, even if the alarm condition
clears in the meantime
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 83
The alarm is acknowledged by closing selector switch SS1
The light will operate in the steady mode when the alarm
trigger condition exists but has been acknowledged
Alarm Monitor Program
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 84
-
7/31/2019 Engg3490 Plc l4
43/574
Down-Counter
The down-counter output instruction will count down
or decrement by 1 each time the counted event occurs.
Each time the down-count event occurs, the
accumulated value is decremented. Normally the down-
counter is used in conjunction with the up counter to
form an up/down counter.
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 85
Generic up/down
counter program
Up/Down Counter Timing diagram
Preset Value = 3
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 86
-
7/31/2019 Engg3490 Plc l4
44/574
Parking Garage Counter Program
As a car enters, it triggers the up-counter output instruction and
increments the accumulated count by 1.
As a car leaves, it triggers the down-counter output
instruction and decrements the accumulated count b 1.
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 87
Since both the up- and down-counters have the same address,
the accumulated value will be the same in both.
Whenever the accumulated value equals the preset value, the
counter output is energized to light up the Lot Full sign.
Parking Garage Counter Program
50
50
38
38
150
150
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 88
-
7/31/2019 Engg3490 Plc l4
45/574
PLC-5 And SLC-500
Count-Down Counter Instruction
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 89
If the accumulation value is below the
minimum range then the underflow
(UN) bit will be true.
Up/Down-Counter Program
When the CTU instruction
is true C5:2/CU will be true
1
When the CTD instructionWhen the accumulated value
10
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 90
causing output A to be trues rue, : w e rue
causing output B to be trueis greater than or equal to thepreset value, C5:2/DN will be
true, causing output C to be
true
Input C going true will causeboth counter instructions to
reset
-
7/31/2019 Engg3490 Plc l4
46/574
In-Process Monitoring System
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 91
Before start-up, the system is completely empty of parts, and
the counter is reset manually to zero.
In-Process Monitoring System
85
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 92
85
-
7/31/2019 Engg3490 Plc l4
47/574
Counter Speed
The maximum speed of transitions you can count isdetermined by your program's scan time. Any counter
counted reliably.
If the input changes faster
than one scan period, the
count value will become
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 93
unreliable because counts
will be missed. When this isthe case you need to use a
high-speed counter.
Cascading Counters
Depending on the
app ca on, may e
necessary to count events
that exceed the maximum
number allowable per
counter instruction. One way
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 94
interconnection, or
cascading, two counters.
-
7/31/2019 Engg3490 Plc l4
48/574
Counting Beyond The Maximum Count
15000
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 95
Counting Beyond The Maximum Count
The output of the
first counter is
programmed into
the input of the
second counterThe status
bits of both
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 96
coun ers areprogrammed
in series to
produce an
output
These twocounters allow
twice as many
counts to be
measured
-
7/31/2019 Engg3490 Plc l4
49/57
-
7/31/2019 Engg3490 Plc l4
50/57
-
7/31/2019 Engg3490 Plc l4
51/575
Incremental Encoder
The number of square waves obtainedfrom the output of the encoder can be
movement required.
To divide a shaft revolution into 100
parts, an encoder could be selected to
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 101
supply 100 square wave cycles per
revolution. By using a counter to
those cycles, we could tell how far
the shaft has rotated.
Cutting Objects To A Specific Size
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 102
The object is advanced for a specific distance and measured
by encoder pulses to determine the correct length for
cutting.
-
7/31/2019 Engg3490 Plc l4
52/575
Counter Used For Length Measurement
Count input pulses generated by the magnetic sensor, which
detects passing teeth on a conveyor drive sprocket. If 10 teeth perfoot of conveyor motion pass the sensor, the accumulated count of
.
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 103
The photoelectric sensor monitors a reference point on theconveyor. When activated, it prevents the unit from counting,
thus permitting the counter to accumulate counts only when bar
stock is moving.
Counter Used For Length Measurement
10
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 104
Photo sensor activated, therefore,
accumulated count remains at 10
-
7/31/2019 Engg3490 Plc l4
53/575
Combining Counter And Timer Functions
When the start button is pressed,
conveyor M1 begins running.
After 15 lates have been stacked
conveyor M1 stops and conveyor
M2 begins running.
After conveyor M2 has been
operated for 5 s, it stops and the
sequence is repeated
automaticall .
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 105
Automatic Stacking Process
The done bit of the timer resetsthe timer and counter, and
provides a momentary pulse to
automatically restart conveyor
M1.
Automatic
Stacking
Program
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 106
-
7/31/2019 Engg3490 Plc l4
54/575
Motor Lock-Out Program
Designed to prevent
a machine operator
from starting a
The normally open (OL) relay
contact momentarily closes
each time an overload current
motor that has
tripped off more
than 5 times in an
hour.
s sense .
Every time the motor stops
due to an overload condition,
the motor start circuit is
locked out for 5 min.
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 107
If the motor trips off more
than 5 times in an hour, the
motor start circuit is
permanently locked out and
cannot be started until the
reset button is actuated.
Motor
Lock-Out
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 108
rogram
-
7/31/2019 Engg3490 Plc l4
55/575
Product Flow Rate Program
This program is designed to indicate howmany parts per minute pass a given
rocess oint.
Parts
When the start switch is closed, both the counter and timer
are enabled.
The counter is pulsed for each part passing the sensor.
The counting begins and the timer starts timing through its
Sensor
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 109
1-min time interval.
At the end of 1 min, the timer done bit causes the counterrung to go false. Sensor pulses continue but do not affect the
PLC counter. The number of parts for the past minutes are
represented by the accumulated value of the counter.
Product Flow Rate Program
60
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 110
28
-
7/31/2019 Engg3490 Plc l4
56/575
Timer Driving A Counter For Long Time-Delay Period
Each timer T4:0
input closes for
10,000 s, its done
bit resets itself
and increments
10,0000
1
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 111
: y .
The output light turns on 10,000 x
100, or 1,000,000 seconds after the
timer input contact closes.
Assignments Chapter 7 and 8 (PLC) book: Problems
- -web page.
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 112
-
7/31/2019 Engg3490 Plc l4
57/57
ENGG3490: Mechatronics W07. Adapted From Programmable Logic Controllers By F. D. Petruzella, McGraw-Hill 113