ABSTRACT

A PLC counter counts up or down until it reaches a limit. When the limit is reached the output is set. In fact, this type of counting is widely used in PLC programming. Often it is necessary to count different entities, an example of which could be keeping track of how many times a process has been completed, or how many products have been produced. The following counter macros are described in this chapter: “CTU_8” (8-bit up counter), “CTU_16” (16-bit up counter), “CTD_8” (8-bit down counter), “CTD_16” (16-bit down counter), “CTUD_8” (8-bit up/down counter), “CTUD_16” (8-bit up/down counter), “GCTUD_8” (8-bit generalized up/down counter), and “GCTUD_16” (16-bit generalized up/down counter). Six examples are considered to show the application of the counter macros presented in this chapter.