Relay Ladder Logic
Ladder diagrams, or Relay Ladder Logic (RLL), are the primary programming language for programmable logic controllers (PLCs). Ladder logic programming is a graphical representation of the program designed to look like relay logic. This convention goes back to the early days of PLCs when electricians and technicians were trained in relay logic and expected to troubleshoot these new devices as well.
The drawings show both the similarities and differences in the two types of programs. The relay logic drawing shows switches electrically connected to coils-solenoids, pilot lights, etc. The ladder diagram uses contacts to represent the switches, or any input, and the coil symbol to represent an output. A line showing an input or several inputs and an output is known as a rung.
The relay diagram used electrical continuity to show a rung as electrically closed. Ladder logic programming shows the results of a status check of the inputs and outputs where the conditions are true or not true. The original intent of RLL was to provide a way for the controller to solve logic sequences involving discrete signals.
Basic and function block rungs
The top rung of the ladder diagram shown represents a basic rung of logic. It consists of a set of input condition instructions, represented by contact symbols, and an output instruction, represented by a coil symbol. Condition instructions are placed on the left side of the rung and may be in series, parallel, or a combination of the two to determine the desired control logic. The output instruction is placed on the right side of the rung.
The line on the left side of the rung represents the imaginary 'hot' power trail while that on the right side is the imaginary 'neutral.' If any left to right path on a rung is 'closed' or 'made,' then the rung is said to be 'true' and the output is energized. This is also known as logic continuity.
As the computer chip used in the PLC became more powerful, engineers saw that there were many more uses for these controllers. The PLC became more of a computer and not just a 'relay replacer.' To take advantage of this power, additions to the instruction set were necessary. Thus were born 'function blocks.'
In most controllers, operations such as timing, counting, arithmetic, data transfer, and other advanced operations are represented by a block diagram (see the second rung in the example). Since these instructions are performed when a certain set of input conditions are true, these are considered output instructions even though sometimes there is no 'output' performed.
In the example there are outputs following the block. When the conditions are true to enable the block instruction (EN), then the block instruction will perform its operation. Upon completion of that operation the output will be energized. Sometimes the data in the block must be reset so that the operation can begin again. A rung of logic can be constructed so that when certain input condition instructions are true the block is reset (R).
This article draws upon information from Programmable Logic Controllers: The Complete Guide to the Technology, by C.T. Jones, published by Patrick-Turner Publishing Co., Atlanta, Ga. Telephone number (770)956-7992.