Professional Documents
Culture Documents
Week 08
Typical examples of PLC counters include the
following:
straight counting in a process,
two counters
used to give the sum of two counts, and
used to give the difference between two counts.
combinations of counters and timers to process
control.
Block-formatted
Coil-formatted counter counter instruction.
and reset instructions.
1. Counter Instructions
All PLC manufacturers offer some form of counter instruction as part of
their instruction set. One common counter application is keeping track
of the number of items moving past a given point.
B:0/0 M0.1
The conveyor motor PLC program of Figure 8-17 illustrates the application of an up-
counter along with a programmed one-shot (OSR) transitional contact instruction. The
counter counts the number of cases coming off the conveyor. When the total number of
cases reaches 50, the conveyor motor stops automatically. The trucks being loaded will
take a total of only 50 cases of this particular product; however, the count can be
changed for different product lines. The operation of the program can be summarized as
follows:
• The momentary start button is
pressed to start the conveyor motor
M1.
• The passage of cases is sensed by
the proximity switch.
• Cases move past the proximity
switch and increment the counter’s
accumulated value with each false-
to-true transition of the switch.
• After a count of 50, the done bit of
the counter changes state to stop the
conveyor motor automatically and
reset the counter’s accumulated
value 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 count reset
button.
3. Down-Counter
The down-counter instruction will count down or decrement by 1 each
time the counted event occurs. Normally the down-counter is used in
conjunction with the up-counter to form an up/down-counter.
• If the value of parameter CV (current count value) is equal to or less than 0, the
counter output parameter Q = 1.
• If the value of parameter LOAD changes from 0 to 1, the value at parameter PV
(preset value) is loaded to the counter as the new CV (current count value).
4. Cascading Counters
Depending on the application, it may be necessary to count events
that exceed the maximum number allowable per counter instruction.
One way of accomplishing this count is by interconnecting, or
cascading, two counters. The program of Figure 8-26 illustrates the
application of the technique
when an extremely long time-delay period is required. For example, if
you require a timer to time to 1,000,000 s, you can achieve this by
using a single timer and counter. Figure 8-36 shows how the timer and
counter would be programmed for such a purpose.
5. Combining Counter and Timer Functions
Lab. EXPERIMENT 6
Figure 8-34 shows a motor
lock-out program. This
program is designed to
prevent a machine operator
from starting a motor that
has tripped off more than 5
times in an hour.