PLCtalk.net
Volume 
Automating Manufacturing Systems with PLCs
Chapter
Latches, Timers, and Counters
PDF Version
Pages

Introduction to Latches, Timers, and Counters


Most machine control programs require complex logic that relies on sequences of events in order to drive output actions. Timers, counters, and combinations of internal memory commands are utilized in these event-based program structures.


Introduction to Latches, Timers, and Counters

In chapter 2 of the textbook, we examined some combinations of digital ladder logic. This simple logic is sufficient for most sensor-oriented machine tasks. However, more complex systems cannot be controlled solely with combinatorial logic, primarily because we cannot—or choose not to, for cost reasons—add sensors to detect all conditions. In such cases, we can use events to assess the system's condition. Typical events used by a PLC include:

  • The first scan of the PLC, which is used to trigger startup checks and conditions
  • A certain time delay since an input or other event turned on/off
  • A counter that tracks when a set number of events have occurred; to latch on or unlatch; to lock something on or turn it off

The common theme among these events is that they are based on the answer to slightly more complicated questions. Instead of simply requiring “If this, then do this,” we must now ask “When?” "How many?" or "How long?"

An example of an event-based device is shown in Figure 6.1.

 

Figure 6.1. The logical and event-based response to the press of a button.

 

The input to the device demonstrated above is a push button. On the left side, we see the logical response. When the push button is pressed, the device turns on immediately. Likewise, if the push button is released, the device turns off immediately. If, when the push button is pressed, there is a delay before the device turns on, this indicates an event-based response, as shown on the right.

If a device responds to the immediate action of one or more inputs with only one response, it is considered a logical response. However, if the device is event-based, it can respond to one or more events currently occurring or to past actions.

In this chapter, we will examine latching commands, timers, counters, and other event-based commands in both ladder logic and structured text formats—commands that increase the functionality of PLCs for more complex control algorithms.