Programmable Logic Controllers: Frank D. Petruzella
Programmable Logic Controllers: Frank D. Petruzella
Programmable Logic Controllers: Frank D. Petruzella
Logic Controllers
Third Edition
Frank D. Petruzella
McGraw-Hill
Chapter 8
Programming
Counters
Counters
Common applications of counters include keeping track
of the number of items moving past a given point, and
determining the number of times a given action occurs.
Counter
Applications
Coil-Formatted Counter Instruction
The coil is assigned an
address as well as being
identified as a counter
Same address
7
Up-counter Program Timing Diagram
C5 Counter Data File
Each counter address is made of a 3-word element
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.
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.
RSLogic Counter Commands
Counter C5:3 counts the total number of packages filled per day
10
9
15
10
59
1
1. One common application for a counter is
keeping track of the number of items moving
past a given point. (True/False)
50
One-Shot Rising (OSR) Instruction
The light will operate in the steady mode when the alarm
trigger condition exists but has been acknowledged
Alarm Monitor Program
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.
Generic up/down
counter program
Up/Down Counter Timing diagram
Preset Value = 3
Parking Garage Counter Program
50
38
150
50
150
38
PLC-5 And SLC-500
Count-Down Counter Instruction
1
10
1
10
When
Whenthe the CTU
CTD instruction
theaccumulated
instruction
When
is true, C5:2/CU will be value
true
isgreater
true,CC5:2/CD
isInput going
than true
or will beto
will
equal true
cause
the
causing
causing output
output A to be
B to bewilltrue
true
both
preset counter
value, instructions
C5:2/DN to
be
resetcausing output C to be
true,
true
In-Process Monitoring System
After processing,
Before start-up, finished
the systemparts appearing empty
is completely at the out-feed
of parts, sensor
and
When the
generate operation
down begins, raw parts move through the in-feed
the counter is counts, so the accumulated
reset manually to zero. count of the counter
sensor, with each
continuously part generating
indicates the numberan of up count. parts.
in-process
In-Process Monitoring System
58
8
5
Counting Beyond The Maximum Count
15000
Counter Speed
Depending on the
application, it may be
necessary to count events
that exceed the maximum
number allowable per
counter instruction. One way
of accomplishing this is by
interconnection, or
cascading, two counters.
Counting Beyond The Maximum Count
500
0
10
At the end of 1 min, the timer done bit causes the counter
rung 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
28
Timer Driving A Counter For Long Time-Delay Period
0
10,000
(d) transitional
12. The down-counter output instruction will
increment by 1 each time the counted event
occurs. (True/False)