Lecture 9 - Ch8 Programming Counters
Lecture 9 - Ch8 Programming Counters
Email: [email protected]
Office: E3088
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
For example,
The counter address it to say
in the PLC-5 that
and SLC 0-9999
500 is
is a data table
16-bit BCD(binary coded decimal) and
address, whereas Because
Why
in
that
the the most
toweird
ControlLogix
-32,768 plc's
32767 numbers?! have
it is0ato
and
predefined
65535 is
16-bit counters.
16-bit binary.
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
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 program scan and then goes off.
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 program scan and then goes off.
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
B to
to be
be true
true
both counter
preset instructions
value, C5:2/DN will to
be
resetcausing output C to be
true,
true
In-Process Monitoring System
After processing,
Before start-up, finished
the parts
system is appearing empty
completely at the out-feed
of parts, sensor
and
When the
generate operation
down begins,
counts, raw parts
so the accumulated move through the in-feed
count of the counter
the counter is reset manually to zero.
sensor, with each
continuously part generating
indicates the numberan ofup count. parts.
in-process
In-Process Monitoring System
58
8
5
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
15000
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