7 Programming Counters 2019
7 Programming Counters 2019
Presented by:
1
Count Up (CTU) Counter
◼ The counter is reset when
the Reset (R) input turns
on, or when the Reset
instruction is executed.
◼ The counter stops counting
when it reaches the
maximum value (32767).
◼ Counter numbers:
C0 to C255
2
Count Down (CTD) Counter
◼ The counter resets the
counter bit (Cxxx) and
loads the current value
with the preset value (PV)
when the load input (LD)
turns on.
◼ The down counter stops
counting when it reaches
zero, and the counter bit
Cxxx turns on.
3
Count Up/Down (CTUD) Counter
◼ Counts up each time the
count-up input CU makes
the transition from off to
on, and counts down each
time the count-down input
CD makes the transition
from off to on.
◼ The current value of the
counter maintains the
current count.
4
Count Up/Down (CTUD) Counter
◼ The counter is reset when the
Reset (R) input turns on, or
when the Reset instruction is
executed.
◼ Counter numbers:
C0 to C255
◼ Since there is one current value
for each counter, do not assign
the same counter number to
more than one counter.
Compare Instructions
5
Application Examples
1. Write and simulate a PLC program that will cause a light
to come on only if a PLC counter has a value of 6 or 10.
Application Examples
2. Write and simulate a PLC program based on the following counter
specification:
◼ Counts the number of times a PB is closed.
6
Application Examples
3. Write and simulate a PLC program
that will correctly execute the
conveyor motor control process
illustrated. The operational
sequence can be summarized as
follows:
◼ The start button is pressed to start the conveyor motor.
Application Examples
4. Write and simulate a PLC program
that will correctly execute the
continuous monitoring of items in-
process illustrated. The operational
sequence can be summarized as
follows:
◼ An in-feed photoelectric sensor counts raw parts going into the
system, and an out-feed photoelectric sensor counts finished
parts leaving the machine.
◼ Before start-up, the system is completely empty of parts, and
the counter is reset manually to 0.
◼ When the operation begins, raw parts move through the in-feed
sensor, with each part generating an up count.
◼ After processing, finished parts appearing at the outfeed sensor
generate down counts, so the accumulated count of the
counter continuously indicates the number of in-process parts.
7
Design Problem