Copyright Goodheart-Willcox Co., Inc. 194 Programmable Logic Controllers: Hardware and Programming Examine Figure 9-7. This fi gure displays the PLC ladder logic diagram for Example 9-3. This example is fi set up to match a conveyor scenario. If the number of parts is less than six, a red pilot light indicates that there are not enough parts on the conveyor. The green pilot light turns on when there are at least six parts on the conveyor. DN C5:1 0000 0001 0004 0005 0006 CTU Count up Counter C5:0 Preset 20 Accum 0 End CU DN CD DN CTD Count down Counter C5:1 Preset 6 Accum 0 MOV Move Source C5:0.ACC 0 Dest C5:1.ACC 0 Infeed proximity 1 I:0 Red_PLT 1 O:0 Outfeed proximity 2 I:0 0002 0003 RES Switch 0 I:0 C5:0 RES C5:1 DN C5:1 Green_PLT 0 O:0 Goodheart-Willcox Publisher Figure 9-7. PLC ladder logic diagram for Example 9-3. The infeed proximity switch and the outfeed proximity switch are connected to the count up and count down instructions, respectively. The move (MOV) instruction in rung 0001 copies the content of the count up accumu- lated register to the count down accumulated register. When a part enters the conveyor, the count up register increments. However, when a part leaves the conveyor, the count down register decrements. Therefore, the content of the count down accumulated register is equal to the total number of parts that reside on the conveyor. Examine the count down instruction. When the number of parts on the conveyor is greater than or equal to six, the count down bit (C5:1/DN) is enabled and the count down coil is energized. Therefore, the green pilot light (Green_PLT) is on and the red pilot light (Red_PLT) is off. However, when the number of parts on the conveyor is less than six, the count down bit (C5:1/DN) is disabled and the count down coil is de-energized. Therefore, the green pilot light (Green_PLT) is off and the red pilot light (Red_PLT) is on. Closing the normally open switch resets the counters. Example 9-3