Ladder Logic

Ladder logic diagrams provide a standard representation of circuits that are convenient for design, analysis, and troubleshooting. They can be thought of as a means to describe outputs based on inputs. The vertical rails (the leftmost and rightmost vertical lines) indicate the power source, while the horizontal and vertical lines (the symbols placed on the rungs of the diagram) indicate the possible current flow. Buttons, contacts, limit switches, and coils each have a representative symbol that can be placed on the rungs of the ladder. Upon activation of appropriate contacts, the coil is energized and the appropriate contacts are in either a opened or closed state.

A simple implementation of ladder logic is illustrated in the two images below. Below and to the left is an electrical diagram of a switch and a motor, then below and to the right is the equivalent ladder logic diagram.

Electrical diagram of a switch and a motor. Ladder Diagram of a switch and motor.

Normally Opened and Normally Closed Contacts SYMBOLS & NOTATION:
Relay contacts or switches that are normally opened are depicted by two parallel vertical lines. When activated the switch or contact closes and power flows. Relay contacts or switches that are normally closed are depicted by two parallel vertical lines with a diagonal line running accross them. When activated the switch or contact opens allowing power to flow. The figure to the right illustrates the appropriate symbols.

Outputs allow switches to close; thus, supplying or cutting off power to control devices. Ladder logic indicates what to with an output, regardless of what is attached. Outputs can go to electrical outputs, or to memory.

Below are some output symbols and their respective meanings.

Output that is engaged when energized.

Considering the leftmost symbol above, when it is energized, the output turns on. In contrast, considering the middle symbol above, when it is energized, the output is turned off. The symbol above and to the right represents a one-shot relay. This is where an input will cause the output to go ON for one scan.

When L is energized, X (below, left) will be toggled ON and will stay on until U (below, middle) is energized. This is similar to a flip-flop and will stay set even when the PLC is turned off. Some PLCs allow immediate outputs and do not wait for a program scan to complete before setting an output. The rightmost symbol below represents this characteristic.

Output that is engaged when energized.

The notational identifiers for ladder logic diagrams are X, Y, and C, which is representative of inputs, outputs, and control relays, respectively.

Ladder Logic OR Arrangement
Switches and relay contacts can be wired into the various logic functions, such as OR, AND, and combinations of the two.

An example of the OR arrangement is illustrated in the figure to the left. In this scenario, each switch is located on seperate rungs, each having a power path to the output. Therefore, if either switch, X1 or X2, is turned ON, then the appropriate contact closes and the output Y1 is energized.

Ladder Logic AND Arrangement The figure to the right illustrates the AND condition. In this case, the switches are lined up on the same rung; thus, there is only a single power path to the output. In order for the output Y1 to become energized, both the switches, X1 and X2, must be turned on.

As the diagram indicates, the switches are processed sequentially. For instance, if switch X1 is turned ON and switch X2 is turn OFF, power terminates at switch X2. Likewise, if switch X1 is turned OFF and switch X2 is turn ON, power terminates at switch X1 and switch X2 does not receive power.

Ladder Logic Combination The figure on the left illustrates a slightly more complicated combination of the logical operations and switches. This scenario combines AND and OR operations, as well as switches that are normally opened and normally closed.

To explain, when switch X4 is OFF, the motor is energized through a set of normally closed contacts (X4) on the switch. In the case that X4 is turned ON, its normally closed contacts open and the motor can only be energized by turning ON X1 or X3, which in turn closes the appropriate contact, X1 or X3.

If both switches X2 and X4 are turned ON, then their normally closed contacts will be open. In this state, only when switch X3 is turned ON and its contacts are closed will the motor become emergized.

Ladder Logic with Timer TIMERS:
In addition, timers can be introduced into a control system. The figure to the right illustrates how a timer would be included in a ladder logic diagram. Since the discussion of ladder logic is relative to PLCs, a brief description of PLC timers is appropriate.

Programmable controllers can effectively duplicate electromechanical sequencing drum timers, time-out timers, and counters. They are built into the controller and only need be programmed to be utilized. No additional hardware is required; thus, the electronic equivalent of the aforementioned hardware can often simplify and improve the performance of a control system. This can be accomplished without increasing cost.

Ladder Logic with Timer Ladder Logic with Timer Control relays not only provide decision-making through logic circuit connections, they also allow for the control of power at remote locations and/or allow for the control of a high-voltage or a high-current device with a low current switch.

A schematic representation of a control relay is in the figure to the left. As the figure shows, X1 is open, C1 is de-energized, and Y1 is connected to the 120V source through the normally closed contacts of C1.

In contrast, when X1 is closed, the coil C1 is energized and the movable contact moves to close the normally open contacts. This has the effect of removing the power from Y1 and applying power to Y2. The ladder logic equivalent is illustrated in the figure above and to the right. Note that all parts relative to the same relay are designated by the same number.

A variety of ladder logic schemes exist. For instance, when implementing ladder logic for PLCs the right hand rail is not shown, for the primary elements of programming are only relay contacts and coils. There are no symbolic distinctions made between limit switches, push buttons, and relay contacts. This particular diagramming scheme allows for up to ten elements in each horizontal rung, and up to seven rungs per network. Multiple networks may be utilized to complete a control circuit. Power flow within a network can only flow from left to right, or vertically; it may never flow towards the left.

The PLC implementation of ladder logic is depicted in the image below.

From Job Den Otter, Programmable Logic Controllers,
			Operation, Interfacing, and Programming. 1988, pp 52

Originally ladder logic was developed to mimic relay logic in efforts to ease its acceptance into the manufacturing arena. The initial use of progammable controllers met with some resistance due to the need to acquire new skills and approaches. With the use of ladder logic the paradigm shift was reduced considerably, therefore making programmable controllers (PLCs) more acceptable.

Original relay ladder logic diagrams showed how to hook-up inputs to run outputs. Since then more intricate circuits and control systems have been (and can be) constructed. Following is a brief listing of some of the implementations of ladder logic, minus the diagrams. The list is far from inclusive.

Output Ladder Logic:
The logic required to produce the outputs to operate a given machine.

Drum Timer/Event Ladder Logic:
A logic circuit describes a sequence conditions that must be met sequentially. For example the condition in step 1 must be satisfied before moving on to step 2, and so on.

Error Detection Ladder Logic:
As implied the error detection logic determines if the machine is malfunctioning. If so, all of the outputs are disabled to prevent equipment damage.

Exclusive-OR Circuit:
Used when it is necessary to prevent an output from energizing if two conditions, which can activate an output independently, occur simultaneously.

Start/Stop Circuit:
Used to start or stop a motor or a process, or to simply enable or disable some function.

One-Shot Signal:
One shot (transitional output) is a program generated pulse output that, when triggered, goes HIGH for the duration of one program scan and goes LOW. The one-shot is typically used as a clearing or resetting signal.

Oscillator Circuit:
A simple circuit used to generate a periodic output pulse of any duration.

Since ladder logic was developed to provide a familiar tool for those acquainted with hardwired, relay control systems, it has since become a main stay in industrial control automation.