Controls engineering academy

Ladder Diagram Concepts

Learn the basics of the Ladder Diagram programming language in under 10 minutes

Mailing List

Get great content like this delivered to your inbox every month.

No spam, unsubscribe any time.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Previously, I explained what a PLC is and how it controls a process. As part of that explanation, I showed a small sample of ladder diagram code.

Now, I want to circle back and explain the basics of the Ladder Diagram programming language. In less than 10 minutes, you will learn:

  • How to read Ladder Diagram code,
  • How the most common Ladder Diagram instructions work, and
  • What a seal-in circuit is.

Let's get started.

Ladder Diagram

Ladder Diagram is the most popular programming language for PLCs. It is a high-level graphical programming language that is easy to write and troubleshoot.

In Ladder Diagram, each line of code is called a rung because it resembles a physical rung on a ladder.

Rung

You program ladder diagram logic by adding instructions to the rung and linking the instructions to tags. For now, think of tags as the PLC’s inputs and outputs.

There are two basic categories of instructions. They are input instructions and output instructions.

Output Instructions

Output instructions write a value to a tag and are positioned on the right of the rung.

Here, I have added an Output Energize instruction to the rung and linked it to an output that runs a motor. You may also hear Output Energize abbreviated to OTE.

Output Energize

Let's look at how this is executed in the PLC.

The vertical bar on the left of the rung is called the power rail.

Power Rail

When there is a continuous path from the power rail to an output instruction, the instruction evaluates to true. Another way to say this is that the rung-in condition for the instruction is true.

An Output Energize instruction writes the value true to its linked tag when it evaluates to true. If it does not evaluate to true, then it writes the value false to its linked tag.

In this example, there is always a continuous path from the power rail to the output instruction. So every time this code is executed, the value true will be written to the tag DO_Run_MTR, and the motor will run.

Output is True

Input Instructions

You can use input instructions to control outputs.

Unlike output instructions, input instructions read the value of a tag and evaluate to true or false based on the value of the tag.

Here, I have added an Examine If Closed, or XIC, instruction to the rung and linked it to an input from a start button.

Examine If Closed

When the tag DI_Start_BTN is True, the instruction will evaluate to true. This creates a continuous path from the power rail to the output instruction, and the motor runs.

Motor Runs

When the start button is not pressed, the instruction evaluates to false. Since there isn’t a continuous path to the output instruction, the motor doesn’t run.

Motor Doesn't Run

We can describe this logic as:

If the start button is pressed, then run the motor.

AND Logic

You can also create complex logic on a rung by combining instructions.

If you place instructions in series, you create AND logic where all of the conditions in a set must be true to turn on an output.

Here, I have added an Examine If Open, or XIO, instruction to the rung. This instruction is the exact opposite of an XIC instruction - they evaluate to True if their linked tag is False, otherwise they evaluate to False.

AND Logic

Now the motor will run if the Start button is pressed AND the sensor is not triggered.

Motor Runs

It will not run if the Start button is not pressed or the sensor is triggered.

Motor Doesn't Run

OR Logic

You can also create OR logic by placing instructions in parallel on a rung.

You use branches to place instructions in parallel. A branch creates an alternative path to achieve logical continuity on a rung.

Branch

Now, the motor will run when the Start button is pressed and the sensor is not triggered.

Motor Runs

Once the Start button is released, the motor will continue to run because the motor is running.

Motor Continues to Run

The motor will continue to run until the sensor is triggered.

Seal-In Circuits

This is a common design pattern in PLC programming called a seal-in circuit. It's called a seal-in circuit because the output is sealed in by the branch.

The main components of a seal-in circuit are permissives and interlocks.

Permissives are conditions that have to be true for a process to start, but don’t have to remain true for the process to run. In this case, the Start button is a permissive.

Interlocks are conditions that have to be true for a process to run. If an interlock condition is missing, the process will stop. In this example, the sensor is an interlock condition because the motor won’t run if the sensor is triggered.

Seal-In Circuit Components

In Allen-Bradley Logix 5000 PLCs, seal-in circuits are non-retentive. This means that if the PLC loses power, the output is not true when the PLC is powered up again. That’s really important for logic that controls motors because you don’t want things to start moving unexpectedly.

Seal-in circuits are non-retentive because the Output Energize instruction has pre-scan logic that is executed before the logic is scanned for the first time. This logic sets the instruction to False and unseals the output.

Wrap Up

Now you know the basics of the Ladder Diagram programming language.

In this post, I skipped over a detailed explanation of what PLC tags are. I said that tags represent the PLC’s inputs and outputs, which isn’t a lie, but there is a lot more to tags than that.

In my next post, I’ll explain how tags work in Studio 5000 Logix Designer, which is the development environment for Allen-Bradley ControlLogix and CompactLogix PLCs, in detail.

If you want to be notified when that post is available, subscribe to the mailing list.

Controls Engineering Academy

Start Your 30-Day Free Trial

Learn how to program Allen Bradley Logix 5000 PLCs using Studio 5000 Logix Designer by building projects in your browser. Get access to all of our courses for free for 30 days, then $29.97 per month.