Ladder logic is a method of drawing electrical schematics wherein positive power is on the left hand side of the paper and negative power (or ground) is on the right hand side. Contacts, from switches or relays, are laid out from left to right with the item to be controlled (a light, relay, motor) as the last item on the line.

For example (my creations released to wikipedia):

pos                                       gnd

 |                                         |
 |                                         |
 |--][------------][-------------------O---|
    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.

pos                                       gnd

 |                                         |
 |                            +-------+    |
 |----------------------------+       +----|
 |                            +-------+    |  
 |                         Remote receiver |
 |-----][------------------------------O---|
 |   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.

pos                                       gnd

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

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.