59
The
Count Up/Down Counter (CTUD) counts up by one each
time the count up (CU) input transitions from off to on and
counts down by one each time the count down (CD) input
transitions from off to on. When the accumulated count equals
the preset value (PV), the counter bit turns on. When the reset
input (R) turns on or when a Reset instruction is executed, the
accumulated count resets to zero and the counter bit turns off.
If the count reaches the maximum positive value (32,767),
the next count up input sets the accumulated count to the
maximum negative value (-32,767). Similarly, if the count
reaches the maximum negative value, the next down count
sets the accumulated count to the maximum positive value.
Count Up/Down Counter Counters are common instructions used for counting a wide
(CTUD) Example variety of events such as parts manufactured or packed, items
processed, machine operations, etc. For example, a counter
might be used to keep track of the items in an inventory
storage area.
In the following example, Count Up/down Counter (CTUD) C48
is reset to zero when contact I0.2 closes. This could be event
could be triggered automatically or manually to indicate that the
associated storage location is empty.
When contact I0.0 closes, the counter counts up by 1. This
could be triggered by a proximity switch sensing that an item
has been placed in the storage location.
When contact I0.1 closes, the counter counts down by 1. This
could be triggered by a proximity switch sensing that an item
has been removed from the storage location.
C48
CTUDCU
I0.0
I0.1
I0.2
CD
R
PV
+150
Q0.1
C48