0% found this document useful (0 votes)
39 views

7 Programming Counters 2019

The document discusses different types of counters used in programmable logic controllers (PLCs): count up (CTU), count down (CTD), and count up/down (CTUD). CTU counters increment when a count-up input turns on and output a signal when reaching a preset value. CTD counters decrement on a count-down input and output a signal at zero. CTUD counters can increment or decrement depending on input signals. The document provides examples of how to write PLC programs using counters to control conveyor motors, lights, and monitor parts in a manufacturing process.

Uploaded by

Eliel Basco
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

7 Programming Counters 2019

The document discusses different types of counters used in programmable logic controllers (PLCs): count up (CTU), count down (CTD), and count up/down (CTUD). CTU counters increment when a count-up input turns on and output a signal when reaching a preset value. CTD counters decrement on a count-down input and output a signal at zero. CTUD counters can increment or decrement depending on input signals. The document provides examples of how to write PLC programs using counters to control conveyor motors, lights, and monitor parts in a manufacturing process.

Uploaded by

Eliel Basco
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Programming Counters

Presented by:

Engr. Ojay DL. Santos, M.Eng.

Count Up (CTU) Counter


◼ Counts up from the
current value each time
the count-up input CU
makes the transition
from off to on.
◼ When the current value
is greater than or equal
to the Preset Value (PV),
the counter bit (Cxxx)
turns on.

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

Count Down (CTD) Counter


◼ Counts down from the
current value of that
counter each time the
count-down input CD
makes the transition from
off to on.
◼ When the current value is
equal to zero, the counter
bit (Cxxx) turns on.

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.

Count Down (CTD) Counter


◼ 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.

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.

Count Up/Down (CTUD) Counter


◼ The Preset Value (PV) is
compared to the current value
each time the counter
instruction is executed.
◼ When the current value is
greater than or equal to the
preset value (PV), the counter
bit Cxxx turns on. Otherwise,
the counter bit turns off.

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.

◼ Decrements the accumulated value of the counter each time a


second PB is closed.
◼ The count should not go below zero.

◼ Turns on a light any time the accumulated value of the counter


is between 2 and 6.
◼ The light flickers when the count is greater than or equal to 6.

◼ Stops the light from flickering when the count reaches 9.

◼ Resets the counter to zero when a toggle switch is closed or


when a count of 10 is reached.

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.

◼ Cases move past the proximity switch and increment the


counter’s accumulated value.
◼ 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 and started manually
at any time without loss of the accumulated count.
◼ The accumulated count of the counter can be reset
manually at any time by means of the counter reset button.

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

You might also like