Copyright Goodheart-Willcox Co., Inc. Chapter 9 PLC Counter Instructions 199 Figure 9-12 shows the programming of a counter up function and a counter down (CD) function to determine the number of parts on a section of a conveyor. The LS1 input at address I:1/1 is connected to a counter up function (CTU), and the LS2 input at address I:1/2 is connected to a counter down function. The counter up function keeps track of parts entering a section of the conveyor, and the counter down function keeps track of parts leaving the same section of the conveyor. Refer again to Figure 9-6. The three MOV functions monitor the accumulated numbers in the counter up and counter down functions and move them to an integer register at address N7:0. As each part enters the conveyor, it actuates a limit switch connected to LS1 input at address I:1/1, which adds 1 to the counter up function. The three MOV functions monitor the accumulated numbers of the counter up and counter down functions and organize the net part count in the N7:0 integer register. The master switch (MSW) at address I:1/0 is used to reset the contents of the accumulated registers (C5:0.ACC and C5:1.ACC). Number of Parts on a Conveyor. LS1 counts parts entering, and LS2 counts parts leaving the conveyor. 000 End I:1/0 MSW MSW 001 I:1/0 006 CU DN CTU Count Up Counter C5:0 Preset 1000 Accum 0 MOV Move C5:0.ACC ? Dest C5:1.ACC Accum ? MSW 003 I:1/0 MOV Move C5:1.ACC ? Dest N7:0 ? MSW 004 I:1/0 MOV Move N7:0 ? Dest C5:0.ACC ? I:1/1 LS1 002 I:1/0 MSW CD DN CTD Count Down Counter C5:1 Preset 10 Accum 0 I:1/2 LS2 005 I:1/0 MSW C5:0 RES C5:1 RES Goodheart-Willcox Publisher Figure 9-12. PLC ladder logic diagram for Example 9-8. Programming a counter up function and a counter down function to determine the “net part count” on a section of a conveyor. Example 9-8