314
SECTION
3
PLC
Programming
Industrial Text & Video Company 1-800-752-8398
www.industrialtext.com
CHAPTER
9
Programming
Languages
in the preset register). Also, this counter can keep track of the number of parts
(e.g., filled bottles, machined parts, etc.) that pass a certain point. An up
counter increases its accumulated value (the count value in its accumulated
register) each time the up-count event makes an OFF-to-ON transition. When
the accumulated value reaches the preset value, the counter turns ON the output,
finishes the count, and closes the contact associated with the referenced
output. After the counter reaches the preset value, it either resets its accumu-
lated register to zero or continues its count for each OFF-to-ON transition,
depending on the controller. In the latter case, a reset instruction is used to
clear the accumulated value.
DOWN COUNTER
COUNTER RESET
A counter reset (CTR) output instruction resets up counter and down counter
accumulated values to zero. When programmed, a counter reset coil has the
same reference address as the corresponding up/down counter coils. If the
counter reset rung condition is TRUE, the reset instruction will clear the
referenced address. The reset line in a block format counter instruction sets
the accumulated count to zero (accumulated register = 0). Figure 9-49
illustrates a typical block-formatted counter rung with up, down, and reset
counter instructions. The counter will count up when contact 10 closes, count
down when contact 11 closes, and reset register 1003 to 0 when contact 12
closes. If the count is equal to 15 as a result of either an up or down count,
output 100 will be ON. If the contents of register 1003 are greater than 15,
output 101 will be ON. Output 102 will be ON if the accumulated count value
is less than 15.
A down counter (CTD) output instruction decreases the count value in its
accumulated register by one every time a certain event occurs. In practical
use, a down counter is used in conjunction with an up counter to form an up/
down counter, given that both counters have the same reference registers.
In an up/down counter, the down counter provides a way to correct data that
is input by the up counter. For example, while an up counter counts the
number of filled bottles that pass a certain point, a down counter with the
same reference address can subtract one from the accumulated count value
every time it senses an empty or improperly filled bottle. Depending on the
programmable controller, the down counter will either stop counting down
at zero or at a specified maximum negative value. In a block format
instruction, a down count occurs every time the down input of the counter
transitions from OFF to ON.
CTD
CTR