Copyright Goodheart-Willcox Co., Inc. 198 Programmable Logic Controllers: Hardware and Programming Figure 9-10 shows the programming of a counter up (CU) function. Each time the input at address I:1/0 is closed, it enables and increments by one the content of the accumulated register in the counter up function (C5:0.ACC). During the counting up toward the preset, the done coil (DN) and its corresponding contact (C5:0/DN) in rung 001 are de-energized. When the content of the accumulated register is equal to or greater than eight, the done coil (DN) is energized, which closes its corresponding NO contact (C5:0/DN) in rung 001 and energizes output Y-LT at address O:2/0. Pressing the reset input at address I:1/1 resets the counter’s accumulated register (C5:0.ACC) to zero and de-energizes output Y-LT. Counter Up Reset 000 O:2/0 Y-LT End I:1/0 001 C5:0/DN C5:0 RES 002 I:1/1 003 EN DN CTU Count Up Counter C5:0 Preset 8 Accum 8 Goodheart-Willcox Publisher Figure 9-10. PLC ladder logic diagram for Example 9-6. Programming a counter up function. Example 9-6 Figure 9-11 shows the programming of a counter down (CD) function. Each time the input at address I:1/0 is closed, it enables and decrements by one the content of the accumulated register in the counter down function (C5:1.ACC). During the countdown to the preset, the done coil is energized. In this case, it is holding open the NC contact (C5:1/DN) on rung 001. This is why output Y-LT at address O:2/1 is off during the countdown. When the content of the accumulated register is equal to or less than negative eight (–8), the done coil (DN) is de-energized, which closes the NC contact (C5:1/DN) and energizes output Y-LT at address O:2/1. Closing the reset input at address I:1/1 resets the counter’s accumulated register (C5:1.ACC) to zero and de-energizes output Y-LT at address O:2/1. Counter Down Reset 000 O:2/1 Y-LT End I:1/0 001 C5:1/DN C5:1 RES 002 I:1/1 003 CD DN CTD Count Down Counter C5:1 Preset –7 Accum –9 Goodheart-Willcox Publisher Figure 9-11. PLC ladder logic diagram for Example 9-7. Programming a counter down function. Example 9-7