6 Counter Macros

 

In this chapter, the following counter macros are described:

  1. CTU_8 (up counter)

  2. CTD_8 (down counter)

  3. CTUD_8 (up/down counter)

In addition two macros, move_R and load_R, are also described for data transfer

6.1 Move and Load Macros

In a PLC, numbers are often required to be moved from one location to another; a timer preset value may be required to be changed according to plant conditions, or the result of some calculations may be used in another part of a program. To satisfy this need for 8-bit variables, in the PIC16F648A-based PLC we define the macro move_R. Similarly, the macro load_R is also described to load an 8-bit number into an 8-bit variable

The algorithm and the symbol of the macro move_R are depicted in ...

Get Building a Programmable Logic Controller with a PIC16F648A Microcontroller now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.