PLC Programming and Ladder Logic

Fundamentals of Ladder Logic Programming

PLC stands for Programmable Logic Controller which is a specialized computer designed for industrial automation and control. Programmable logic controller’s are used extensively in industrial processes around the world today. So what exactly is PLC Programming and Ladder Logic?

PLC programming uses one or more programming languages to develop software to control industrial processes. This software is then compiled and downloaded into a programmable logic controller. One way to accomplish this is to use a programming language known as Ladder Logic.

It’s important to note that Ladder Logic Programming is just one way to program a PLC. There are other programming languages commonly used to accomplish this task as well. However, Ladder Logic Programming is without question the most common.

In this article we are going to perform an in-depth analysis of the following:

  • What is a PLC?
  • What is PLC Programming?
  • What is Ladder Logic Programming?
  • What are basic Ladder Logic Instructions?
  • How to program a PLC using Ladder Logic?

What is a PLC?

As mentioned at the beginning, PLC is an abbreviation for Programmable Logic Controller and in a nutshell, is a small industrial-grade computer with two core functionalities: monitor various inputs and outputs in an industrial system, and to make logic-based decisions to automatically controls processes and components in machines or automated systems.

PLCs have been around for quite some time and were introduced back in the late 1960’s by the inventor Richard Morley. They were originally designed to replace relay logic systems since relay systems back then tend to create delays and were rigged with various issues.

The PLC was then introduced to eliminate these issues, such as high power consumption of the relay systems (with more relays, more power is required). Since PLCs feature a modular design (that is, they can be plugged into various setups), they don’t use relay switching and so will use less power.

Also, relay systems can cause undesired arcing between contacts, which can generate high temperatures that can lead to mechanical failure. PLCs help prevents these overheating issues.

PLC’s are robust and durable and can perform well in harsh conditions like severe heat/cold, cold, and extreme moisture, making them ideal for industrial applications.

The PLC is arguably the single-most important invention used in industrial manufacturing even until today, six decades after its invention. You can learn further about the definition and concept of the PLC, the differences to relay systems, the hardware, and how a PLC operates in programmable logic controllers article here.

What is PLC Programming?

Simply put, PLC programming is the effort of developing the internal programming logic for a PLC. Without any program, the PLC is just a computer with a processor, an empty shell. So, we program the logic we want the PLC to understand and base its operation in a programming language that is known by the PLC.

If, for example, we want to tell the PLC to “if condition 1 is true, then turn the output of device A”, we use a language proprietary to the PLC, something like “If I1.0=1 then OA.0=1”. PLC programming essentially makes the decision based on input from the real world, and tell the PLC how it should interact with the real world through the outputs.

We’ve assembled a detailed step-by-step guide to PLC programming that we recommend you check out here.

Different Languages Used in PLC Programming

However, there are 5 PLC programming languages defined by the IEC 61131-3 standard, and below we will discuss them briefly. For a more indepth look a the different programming languages available, check out our article here.

Ladder Diagram (LD)

Ladder Diagram is the most common language used to program PLC and is also commonly known as Relay Ladder Logic (RLL). The Ladder Diagram is a graphical language (rather than text-based language) that visualizes the relationships between the inputs and outputs of the system.

Every Ladder Diagram is arranged similarly to an electrical diagram, and so we can say that the resulting ladder diagrams are virtual circuits.

They are called “ladder” because the diagram literally resembles a ladder with two vertical rails (the supply power/contact) and horizontal lines (the rungs) to represent the control circuits/relay coils.

None of these supply power and control circuits seen in a Ladder Diagram program are real, but they are virtual bits in the PLC memory.

Function Block Diagram (FBD) 

Function Block Diagram (FBD) is based on—as the name suggests—, the function blocks. It is also a graphical, visual language, and for those who are familiar with Boolean systems, FBD would feel more intuitive than the Ladder Diagram language.

The FBD, like the LD, also resembles electrical wiring diagrams. However, if in LD the diagram is more akin to relay logic systems, in FBD it’s more like we are wiring the function blocks together.

In FBD, inputs are placed on the left of the function blocks and outputs on the right.

We can say that FBD is a simpler, more intuitive version of the LD language. However, to start programming in FBD language, we need to understand what the function blocks do, and so might have a steeper learning curve than LD.

Due to its similarities with LD, both the FBD and LD have a similar weakness: when the program becomes long or complex, it can be very difficult to trace every step and troubleshooting.

Structured Text (ST) 

Unlike LD and FBD, Structured Text is—as the name suggests— is a text-based language.

While it’s more intuitive to use graphical programming languages for PLC programming, like the LD or FBD, they have their weakness, as we have briefly discussed above.

A text-based PLC program will take up a much smaller file size, and when the program gets very long/complex, it will be easier to read and understand than a graphical language.

Another advantage of the ST language is that we can easily combine it with different programming languages. For example, we can have FBD function blocks containing functions written in ST.

Instruction List (IL) 

Similar to ST, the Instruction List (IL) is not a graphical programming language, but it’s a low-level programming language more similar to assembly language.

As the name suggests, the IL is a set of instructions.

There are common mathematical operators listed, like addition, subtraction, multiplication, and divisive functions. There are also functions to call and return from different functions.

The main benefit of the IL compared to other PLC programming languages is speed. Like any other low-level programming languages, IL is low in overhead and so will execute much faster than a graphical language. It also takes up less memory, which can be a huge benefit in a PLC with limited memory space.

However, there is also a major drawback in using IL: assembly language is simply not that common, and so learning to use it can be a challenge since the available resources are also relatively limited.

Sequential Function Charts (SFC) 

The Sequential Function Charts language is also a graphical PLC programming language (not text-based) and is ideal for breaking down a large and complex process into smaller bits.

There are two core elements of a sequence in the SFCs: steps and transitions. A ‘step’ is any function within the industrial system and a transition is a condition between one step and another.

An SFC program can also include various standard logical programming like parallel/alternative branching and feedback loops.

If the PLC manufacturer offers SFC programming, typically they will provide additional documentation to allow users to implement and customize the SFC programs.

More About Ladder Diagram/Ladder Logic

As mentioned, Ladder Diagram (LD) or Relay Ladder Logic (RLL) is the most popular programming language in PLC programming, and so here we will delve further into it.

Ladder Logic is essentially a rule-based language that approximates an electrical wiring/circuit diagram as a graphical programming language.

Ladder Logic is most commonly applied for designing logical switching units (i.e. on/off, start/stop button).

However, it is versatile enough and can be implemented to create networks like the FBD (Function Block Diagram), so you can use Ladder Logic to control other program blocks.

The Ladder Logic program consists of networks: on the left side, these networks are bound by a vertical line (the bus bar), and a network contains a circuit diagram of POUs, contacts, coils, and connecting lines.

On the left side, there is a series of contacts that relays the ‘1’ (on) or ‘0’ (off) state, which corresponds to the true or false boolean values.

A boolean variable is associated with each of these contacts, and if the variable is true, the status is then relayed from the left to right via the line, and the coil in the right side of the network will receive either the ‘0’ or ‘1’ value coming from the left.

The value true or false is then written accordingly. We will further discuss this by discussing the basic ladder logic instructions below.

What are basic Ladder Logic Instructions?

Below, we will discuss five basic instructions that are common in Lader Logic (Ladder Diagram):

1. XIC (Examine if Closed) 


Examine if Closed, or XIC, examines a bit status of data to see if it is ‘true’. It is active/true when the bit status is in a ‘1’ state, and it is not active/false if the bit status is in a ‘0’ state. XIC instruction is applied in your ladder logic to determine if a bit is ‘true’ or ON. This instruction is always found on the left side of a ladder rung.

To summarize:

  • If the binary bit is true, rung condition is set to true
  • If the binary bit is false, rung condition is set to false

Common applications of XIC instruction are:

  • Start/stop button
  • Limit switch
  • Proximity switch
  • Light on/off
  • Internal bit
  • Selectors

2. XIO (Examine if Open) 



Examine of Open or XIO is essentially an instruction that performs the opposite to the XIC (Examine if Closed).

So, it evaluates a bit status for an ‘off’ or 0 state, and only then it will evaluate to true. When that’s the case, the XIO instruction will execute the rest of the rung.

The XIO instruction is commonly used to evaluate the status of inputs on the PLC, but can be used on any boolean to examine whether the program’s boolean is energized.

This instruction is always found on the left side of a ladder rung.

To summarize:

  • If the binary bit is false, rung condition out is set to true
  • If the binary bit is true, rung condition out is set to false

Common applications of XIO instruction are mostly similar to XIC:

  • Start/stop button
  • Limit switch
  • Proximity switch
  • Light on/off
  • Internal bit
  • Selectors

3. OTE (Output Energize)



The OTE (Output Energize) instruction will either set (energize) or clear a data bit depending whether the input leading to it is true or false. This instruction is always found on the right side of a ladder rung.

It will turn a bit into a high state (energized) if the preceding input evaluates to be true. On the other hand, it will turn a bit into a low state (cleared) if the preceding input evaluates to be false.

To summarize:

  • If the OTE instruction is true, the controller sets the data bit
  • If the OTE instruction is false, the controller clears the data bit

Common applications of OTE instruction are:

  • Motor run signal
  • Lighting
  • Internal bit

4. OTL (Output Latch)



The OTL or Output Latch will force a bit into a ‘1’ state if all the preceding inputs leading to it are true.

This instruction is always found on the right side of a ladder rung, and will switch a bit status to a high state. OTL will maintain this condition and unlike OTE instruction, will never turn the bit low.

OTL is commonly paired with OTU (which we will discuss below).

OTL and OTU can be used to energize any boolean within the program, so they are quite versatile. At first glance, it might seem like a good idea to introduce OTU and OTL for all bits, but there might be scenarios where the logic will depend on the rung’s position.

So, avoid using OTL and OTU unless they are absolutely needed.

To summarize:

  • OTL sets the bit to “1” when the rung becomes true, and retains this state when a power cycle occurs or when the rung loses continuity
  • OTL is a retentive output, and can only turn on a bit to a ‘1’ state
  • Ladder logic can examine a bit controlled by OTL as often as required.
  • The output device wired to the screw terminal is energized when a bit is set. When rung conditions become false, the bit remains energized, and the corresponding output also remains energized.
  • The latch input causes the function to change state. The function then stays on even when the latch input is turned off. If we want to turn off the function, we must use OTU instruction to unlatch. 
  1. OTU (Output Unlatch)



OTU, or Output Unlatch will set the bit status to ‘0’ when all the preceding conditions leading to it evaluate to true. As with OTL, this instruction is always found on the right side of a ladder rung and will turn the bit to a ‘0’ (low) state when all preceding conditions are true.

So, it’s the exact opposite of the OTL instruction, and it will retain the ‘0’ state and never turn a bit to ‘1’.

Again, it might seem like a good idea to introduce OTU and OTL for all bits, but there might be scenarios where the logic will depend on the rung’s position.

So, avoid using OTL and OTU unless they are absolutely required.

To summarize:

  • OTU resets the bit to “0” when the rung becomes true and will maintain this state.
  • OTU is a retentive output instruction and can only turn off a bit to ‘0’ state
  • Ladder logic can examine a bit status controlled by OTU as often as required
  • The output device wired to the screw terminal is de-energized when a bit is cleared. When rung conditions become true, the bit remains de-energized, and the corresponding output also remains de-energized.

How to program a PLC using Ladder Logic?

Before we get going with PLC programming and using ladder logic. It is highly recommended that you familiarize yourself with PLC hardware and the basics of PLC programming and boolean logic. These articles will teach you a lot.

As mentioned ladder logic programming is graphical be design. This makes it very easy to program boolean expressions and logic. We’ve discussed basic ladder logic instructions above. You’d be surprised how many processes you can program with just these instructions alone.

Let’s take a look at an example. In this example we will make use of all the instructions we discussed, namely, the XIC (eXamine If Closed), the XIO (eXamine If Open), and the OTE (OuTput Energize) to control a simple motor start/stop circuit (with seal-in) using ladder logic programming.

Below is an image of this circuit built using ladder logic on Rockwell’s ControlLogix platform of programmable automation controllers. The instructions that are illuminated green indicate that the instruction is in its TRUE state.

PLC Programming using Ladder Logic - Motor Start-Stop

Let’s analyze this circuit starting with the Starting with the Start_Motor_PB.

  • The Start_Motor_PB is using an XIC instruction to monitor the ON state of Input Point 0 of the input module residing in Slot #1 of the PLC chassis as indicated by the text between the carrots <Local:1:I.Data.0>. This type of construct is known as Aliasing — see the YouTube video at the end of this section for more information on this. This push button would be normally open (N.O) and momentary – meaning – we push the button to start the motor and release it.
  • The Stop_Motor_PB is also using an XIC instruction, however, this would typically be wired to a normally closed (N.C.) push button. This means the Input Point 1 would have voltage at all times until the operator presses the push button to break the circuit. Which would subsequently turn off the motor.
  • The next input instruction is an XIC and it is monitoring the overload relay of the motor. You can see in this case we are monitoring the OFF condition to be TRUE. In other words, if the motor overload is NOT TRIPPED the instruction is TRUE.
  • The next instruction is the output instruction or OTE. This output module is residing in Slot #2 of the PLC chassis and when this output turns ON, voltage and current is sent to the Output Point 0 which is wired to the coil of the contactor controlling the motor.
  • The last instruction we have not mentioned is the XIC that is located around or Branched (this indicates a logical OR condition) around the Start_Motor_PB. We are using the Motor_Contactor_Enable tag itself to seal-in the momentary start push button.
  • What this does is allows the operator to remove her finger from the start push button and if the motor turns on (Stop_Motor_PB AND Motor_Overload_Tripped are both in their TRUE state), the motor output will stay on even after the push button is released and the instruction goes FALSE.
  • Then the motor output would remain TRUE until either the Stop_Motor_PB goes FALSE (meaning the operator presses the stop push button), or the Motor_Overload_Tripped goes FALSE (meaning the overload of the motor has tripped – remember where are using an XIO here to monitor the OFF condition).

This is just a brief example of how to perform PLC programming using Ladder Logic. I encourage you to work through our playlist of videos on our YouTube channel. Here is a few videos from that playlist. You can also view them on our Learn PLC Programming page.

How To Become a PLC Programmer?

Being a PLC programmer requires a specialized skill set that combines electrical, mechanical and software engineering. A PLC programmer must possess strong analytical thinking and problem-solving skills.

In general, here are the required skills of a PLC programmer:

  • Software engineering skills: PlC programmers are expected to understand common programming languages for PLC programming, algorithms, and logical flow of program implementations
  • Mechanical and electrical knowledge: PLC programmers are expected to be involved in physically implementing the PLC programs, and in some cases, mechanical troubleshooting might be necessary
  • Logical reasoning: Programmers are expected to use rational steps and mathematical concepts to design the flow of a program.
  • Design skills: Strong program design and architecture principles are required to design graphical programs and to draft 3D blueprints and drawings.
  • Problem-solving: PLC programmers must be able to identify the source of a problem and create a solution.

Educational Requirement

The current changes in software development and increasing complexity have allowed most employers to prefer candidates with at least a bachelor’s degree. PLC programmers typically hold at least a college degree in the fields of computer science, electrical engineering, or mechanical engineering. There is currently no degree or direct vocational training that trains you as a PLC programmer specialist.


PLC programmers are expected to:

  • Analyze the specific situation or problem to be solved
  • Decide on a possible solution
  • Design the solution into logic
  • Write that logic with a proper programming language 

There are many paths to becoming a PLC programmer. We did a comprehensive article on the different paths to PLC programming here.

How Much Does a PLC Programmer Make?

According to the U.S. Bureau of Labor Statistics (BLS), the median annual wage of a PLC programmer is $56,749. The top 10 percentile earns more than $87.970, and the lowest 10 percentile earns less than $36,550.

For more information on how much a PLC programmer makes, I encourage you to check out our article here.

Some final words from PLCGurus.NET

If you haven’t already done so yet, I do encourage you to become a member of the site. PLCGurus.NET is quickly becoming one of the largest and fastest growing communities of professional engineers, technicians and technologists who all share a passion for industrial automation and control systems.

Registration is and will always remain completely free. Register Here! Also, be sure to check out the PLCGurus.NET YouTube Channel to see some great videos…and don’t forget to like and subscribe to our channel.

Lastly, if you run into any problems in your day-to-day engineering activities please be sure to check out our Live and Interactive PLC Forum! And if you so desire, assist other community members by replying or offering helpful information to the questions or challenges they may be facing right now! Thanks for reading.