Using the counter instruction
This is an instruction that can either count up or down when its input is triggered, and an output is activated when the set value is reached. It can be used to determine the number of times an event has happened in a process. In this section, we will be looking at the common counter instructions, including counting up and counting down.
Count up (CTU)
The count up instruction will count up or increase by 1 each time its input is triggered (0 to 1); for example, when a button is pressed and released or when a sensor is activated. The counter’s output will be energized when the number of times the input is triggered (current value of the counter) is equal to, or greater than, the pre-set value (PV).
In this example, a pilot lamp (PL1) is connected to Q0.0. A PNP proximity sensor (NO) is connected to I0.0 and a normally open push button is connected to I0.1, as shown in the following wiring diagram:
Figure 9.41...