Вы находитесь на странице: 1из 11

PLC Counters

Objectives
1. Examine how PLC counters aid in control.
2. Identify the different types of counters in the
Siemens s7200 PLC
3. Create a ladder logic program using counters
Counters
used in PLCs serve the same function as mechanical
counters. Counters compare an accumulated value to a
preset value to control circuit functions. Counters can
be used to initial an operation when a count is reached
or to prevent an operation from occurring until a count
has been reached.
Bottling Machine

A bottling machine, for example, may use a counter to


count bottles into groups of six for packaging.
Three Types of Counters in Siemens S7200

There are 256 counters available in the S7-200, numbered


C0 through C255.
The same number cannot be assigned to more than one
counter.
Count Up Counter (CTU)
The Count Up Counter (CTU) counts up
from the current value each time the
count up (CU) input goes from off to on.
When the current value is greater than
or equal to the preset value (PV), the
counter bit for designated counter is a
logic 1.
The course resets when the reset (R)
input turns on.
The counter stops counting when it
reaches its maximum value of 32,767.
Count Down Counter (CTD)
The Count Down Counter (CTD)
counts down from the current value
each time the count down (CD) input
goes from off to on.
When the current value is equal to zero,
the counter bit for designated counter is
a logic 1.
The counter stops counting at zero.
The counter resets and loads the
current value with the preset value (PV)
when the load input (LD) turns on.
Count Up Down Counter (CTUD)
The Count Up/Down Counter (CTUD) counts
up each time the (CTUD) count up (CU) input
turns on and counts down each time the count
down input (CD) turns on.
When the current value is equal to or greater
than the preset value (PV), the counter bit for
the designated counter is a logic 1. Otherwise,
the counter bit is a logic 0.
If the count reaches 32,767, the next count
changes the current value to -32,768.
The counter current value is reset to zero when
the reset (R) input turns or when the Reset
instruction is executed.
Example
A counter might be used to
keep track of the number of
vehicles in a parking lot. As
vehicles enter the lot through
an entrance gate, the counter
counts up. As vehicles exit the
lot through an exit gate, the
counter counts down. When
the lot is full a sign at the
entrance gate turns on
indicating the lot is full.
Example
Entrance gate

Exit gate

Reset
Packaging Line Control
When PB1 (START Push
Button) is pressed, the box
conveyor moves. Upon
detection of box present,
the box conveyor stops and
the apple conveyor starts.
Part Sensor will count 10
apples. Apple conveyor
stops and box conveyor
starts again. Counter will
reset and operation
repeats until PB2 (STOP
Push Button) is pressed.

Вам также может понравиться