5 Timer Macros

 

In this chapter, the following timer macros are described:

  1. TON_8 (on-delay timer)

  2. TOF_8 (off-delay timer)

  3. TP_8 (pulse timer)

  4. TOS_8 (oscillator timer)

Timers can be used in a wide range of applications where a time delay function is required based on an input signal. The definition of 8-bit variables to be used for the timer macros, and their allocation in BANK 0 of SRAM data memory are shown in Figure 5.1(a) and (b), respectively. The status bits, which will be explained in the next sections, of all timers are defined as shown in Figure 5.2(a). All 8-bit variables defined for timers must be cleared at the beginning of the PLC operation for a proper operation. Therefore, all variables of timer macros are initialized within ...

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.