Ladder logic is the basis of most control functions

Ladder logic uses switch or relay contacts to implement Boolean expressions. In years past, ladder logic was made possible with discrete relays and was sometimes termed “relay logic.” Today most implementations are done using a specialized microprocessor-based device called a programmable logic controller (PLC). Although the means of implementation have changed over the years, the basic concepts remain the same.

Logical functions. When studying logic, one must begin with the basic functions. Input values can be combined using the logical AND, OR, and exclusive OR (XOR) functions (Fig. 1 at right). Logic gates use digital electronics to implement these functions. Each gate is actually a circuit, typically consisting of transistors and biasing resistors. As an example, the transistor-transistor logic (TTL) 7408 chip contains four, two-input AND gates in one integrated circuit (IC) package. These gates and other types on separate ICs can be wired together to implement a wide array of digital logic.

In the case of ladder logic, logic functions are implemented by developing a ladder diagram. Named for its resemblance to a ladder, the diagram consists of two vertical rails connected by several horizontal rungs. Each rail is energized at a different voltage, and each rung contains at least one element, such as a relay coil or an indicator lamp, across which voltage can drop. In a ladder circuit, normally open (type-A) and normally closed (type-B) contacts are interconnected so as to implement the logical functions. Connecting two contacts in series implements an AND function, since the first and second contacts must both be closed to complete the circuit. Connecting the same two contacts in parallel implements a logical OR, since at least one contact must be closed to complete the circuit. An XOR implementation for two inputs, which is actually [(A AND B') OR (A' AND B)] where the prime mark indicates a logical NOT or inversion, requires a type-A and a type-B contact for both inputs.

A relay coil, whether it's a discrete device or a “virtual” device mimicked by PLC software, controls one or more sets of contacts. When a relay coil is energized or “picked up,” its type-A contacts close and its type-B contacts open. Conversely, when the coil is de-energized or “dropped out,” its contacts return to their normal state.

Seal-in function. Many times, momentary pushbuttons are used to provide user input to a control circuit. If such a switch is used as a start pushbutton for a motor, the switch must be “sealed-in” so the motor doesn't stop when the pushbutton is released. This requires a path to develop around the switch so current can continue to flow after the switch contacts open. The seal-in function can be provided with a relay coil and a single set of type-A contacts as shown in the dashed box in Fig. 2. When the start button is pushed, the SI relay picks up and its type-A contacts close, providing a current path after the start pushbutton is released.

### Other functions.

A variety of specialized input devices, such as temperature sensors, pressure switches, position indicators, and flow switches, can provide input to the ladder logic circuit. Devices like timers and counters can also be added to make more complex logic possible. Fig. 2 shows a simple motor control circuit that will only allow the motor to start — and remain running — when its lube oil pump is running, at least one valve is open, and no alarms exist. Pressing the stop button drops out the SI coil, stopping the motor. Indicator lamps — red for running, green for stopped — can also be used. This basic control circuit forms the basis for much more complex control circuits.