Ladder logic

From Academic Kids

Ladder logic or the Ladder programming language is a method of drawing electrical logic schematics. It is now a graphical language very popular for programming programmable logic controllers. It was originally invented to describe logic made from relays. The name is based on the observation that programs in this language resemble ladders, with two vertical "rails" and a series of "rungs" between them.

A program in ladder logic, also called a ladder diagram, is similar to a schematic for a set of relay circuits. Ladder logic is useful because a wide variety of engineers and technicians can understand and use it without much training.

Ladder logic is widely used to program industrial Programmable logic controllers, where a series of complex logic checks are required before something is turned on. Ladder logic is useful for simple but critical control systems, or for reworking old hardwired relay circuits. As programmable logic controllers became more sophisticated it has also been used in very complex automation systems.

Most providers of programmable logic controllers also provide associated ladder logic programming systems. Typically, the ladder logic languages from two different providers will not be compatible; ladder logic is better thought of as a set of closely related programming languages rather than one language.

Ladder logic can be thought of as a rule-based language, rather than a procedural language. A "rung" in the ladder represents a rule. When implemented with relays and other electromechanical devices, the various rules "execute" simultaneously and immediately. When implemented in a programmable logic controller, the rules are typically executed sequentially by software, in a loop. By executing the loop fast enough, typically many times per second, the effect of simultaneous and immediate execution is obtained.

Example of a simple ladder logic program

The language itself can be seen as a set of connection between logical checkers (relay contacts) and actuators (coils).

Ladder logic has "contacts" that "make" or "break" "circuits" to control "coils."

There are two types of contacts:

--[ ]-- a relay normally open (N/O) contact. This contact turns on if the relay's coil is on.

--[\]-- a relay normally closed (N/C) contact. This contact turns off if the relay's coil is on.

These are switched by a circuit (or more archaically the "coil" of a relay). They in turn switch a circuit. In a ladder programmign language, the circuits are represented by a name or number.

The contacts represent electrical switches. They form logic that can be configured to produce any logical function such as AND, OR, XOR, NAND, NOR, INV.

Here is an example of what one rung in a ladder logic program might look like. In real life, there would typically be hundreds or thousands of rungs.

 ---[ ]-----[ ]---
     X       Y 

Represents X AND Y, because both X and Y must be on for the circuit to be on.

 ----|---[ ]---|------
     |    X    |
     |         |
     |---[ ]---|

Represents X OR Y, because the circuit will be on if either X or Y are on.

     |    X    |
     |         |

Represents X NAND Y, because the circuit will turn off only if both X and Y are turned on.

Ladder logic is then used to drive output coils, so that when the preceding logical functions have been evaluated - the output coil changes state.

--( )-- an N/O output coil

--(\)-- an N/C output coil

For Example

 ----[ ]---------|--[ ]--|------( )--
      X          |   Y   |       S
                 |       |
                 |--[ ]--|

Realises the function S= X.(Y+Z)

Complex ladder logic is 'read' in the same way as a western book (left to right). The first point on the left, is the input signal (or high potential), as each of the lines (or rungs) are evaluated the output coil of a rung may feed into the next stage of the ladder as an input. In a complex system there will be many "rungs" on a ladder, which are numbered in order of evaluation.

 1 ----| |-----------|-| |-----|----( )--
        X            |  Y      |     S
                     |         |
                     |---| |---|
 2 ----| |----| |-------------------( )--
        S      X                     T 


This represents a slightly more complex system for rung 2. After the first line has been evaluated, the output coil (S) is fed into rung 2, which is then evaluated and the output coil T could be fed into an output device (buzzer, light etc..) or into rung 3 on the ladder.

This system allows very complex logic designs to be broken down and evaluated fairly easily.

For more practical examples see below (my creations released to wikipedia):

 |                                         |
 |                                         |
    keysw1     keysw2           door motor

This circut shows the two key switches that security guards might use to activate motor on a bank vault door. When the normally open contacts of both switches close, electricity is able to flow to the motor which opens the door. This is a logical AND.

 |                                         |
 |                            +-------+    |
 |----------------------------+       +----|
 |                            +-------+    |  
 |                         Remote receiver |
 |   remote unlock   |       lock solenoid |
     interior switch

This circuit shows the two things that can trigger the power door locks in my imaginary car. The remote receiver is always powered. The lock solenoid gets power when either set of contacts is closed. This is a logical OR.

Since electrical engineers already knew how to read ladder logic, PLC makers made their systems programmable in ladder logic. This would allow electrical engineers to read, debug, troubleshoot and write computer programs for the PLCs which replaced their cabinets full of relays.

Additional Functionality

Additional functionality can be added to a ladder logic implementation by the PLC manufacturer as a special block. When the special block is powered, it executes code on predetermined arguments. These arguments may be displayed within the special block.

 |                                         |
 |                            +-------+    |
 |-----][---------------------+  A    +----|
 | remote unlock              +-------+    |  
 |                         Remote counter  |
 |                                         |
 |                            +-------+    |
 |-----][---------------------+  B    +----|
 | interior unlock            +-------+    |  
 |                        Interior counter |
 |                                         |  
 |                    +--------+           |
 |--------------------+ A + B  +-----------|
                      + into C +             

In this example, the system will count the number of times that the interior and remote unlock buttons are pressed. This information will be stored in memory locations A and B. Memory location C will hold the total number of times that the door has been unlocked electronically.

PLCs have been very sophisticated with many types of special blocks. They include timers, arithmetic operators and comparisons, table lookups, and filtering functions. In some cases, users can define their own special blocks, which effectively are subroutines or macros. The large library of special blocks along with high speed execution has allowed use of PLCs to implement very complex automation systems.

See also

is:Ladder (forritunarmál)


Academic Kids Menu

  • Art and Cultures
    • Art (
    • Architecture (
    • Cultures (
    • Music (
    • Musical Instruments (
  • Biographies (
  • Clipart (
  • Geography (
    • Countries of the World (
    • Maps (
    • Flags (
    • Continents (
  • History (
    • Ancient Civilizations (
    • Industrial Revolution (
    • Middle Ages (
    • Prehistory (
    • Renaissance (
    • Timelines (
    • United States (
    • Wars (
    • World History (
  • Human Body (
  • Mathematics (
  • Reference (
  • Science (
    • Animals (
    • Aviation (
    • Dinosaurs (
    • Earth (
    • Inventions (
    • Physical Science (
    • Plants (
    • Scientists (
  • Social Studies (
    • Anthropology (
    • Economics (
    • Government (
    • Religion (
    • Holidays (
  • Space and Astronomy
    • Solar System (
    • Planets (
  • Sports (
  • Timelines (
  • Weather (
  • US States (


  • Home Page (
  • Contact Us (

  • Clip Art (
Personal tools