Page 181 - Programmable Logic Controllers, Fifth Edition
P. 181
L1 Inputs Ladder logic program Output L2
Stop Start C5:0/DN Motor
Stop
OL
Motor Motor M
Start
Start
Motor CTU
Reset
COUNT-UP COUNTER CU
Counter C5:0
Reset Preset 10 DN
Accumulated 0
Reset
Stop C5:0
RES
Start
Reset
Figure 8-13 PLC counter program used to stop a motor from running after 10 operations.
• A counter done bit examine-off instruction is • Logix processors use a tag name, such as
programmed in series with the motor output Package_Count, instead of a counter number.
instruction. • This descriptive tag name makes it easier to know
• A motor output examine-on instruction is used to what function the counter serves in the control
increment the accumulated value of the counter for system.
each off/on operation. • The associated counter data (PRE, ACC, CU,
• After the count of 10 is reached the counter done CD, DN, OV, UN) are found within the program
bit examine-off instruction goes false preventing the tags dialog box.
motor from being started.
• Closure of the reset pushbutton resets the accumu- One-Shot Instruction
lated count to zero.
Figure 8-16 shows the program for a one-shot, or transi-
Figure 8-14 shows a PLC can-counting program that tional, contact circuit that is often used to automatically
uses three up-counters. The operation of the program can clear or reset a counter. The program is designed to gen-
be summarized as follows: erate an output pulse that, when triggered, goes on for
• Counter C5:2 counts the total number of cans the duration of one program scan and then goes off. The
coming off an assembly line for final packaging. one-shot can be triggered from a momentary signal or
• Each package must contain 10 parts. from a signal that comes on and stays on for some time.
Whichever signal is used, the one-shot is triggered by the
• When 10 cans are detected, counter C5:1 sets bit leading-edge (off-to-on) transition of the input signal. It
B3:0/1 to initiate the box closing sequence. stays on for one scan and goes off. It stays off until the
• Counter C5:3 counts the total number of packages trigger goes off, and then comes on again. The one-shot is
filled in a day. (The maximum number of packages perfect for resetting both counters and timers since it stays
per day is 300.) on for one scan only.
• A pushbutton is used to restart the total part and Some PLCs provide transitional contacts or one-shot
package count from zero daily. instructions in addition to the standard NO and NC contact
The counter instructions for the SLC 500 and Control- instructions. The off-to-on transitional contact instruc-
Logix 5000 processors operate in exactly the same tion, shown in Figure 8-17a, is programmed to provide a
manner. Figure 8-15 shows the counter selection toolbar, one-shot pulse when the referenced trigger signal makes
CTU counter instruction, and program tags dialog box for a positive (off-to-on) transition. This contact will close
a ControlLogix controller. for exactly one program scan whenever the trigger signal
162 Chapter 8 Programming Counters
pet73842_ch08_156-183.indd 162 03/11/15 3:58 PM