Ladder Logic Program

  

Download Ladder Logic Simulator 6.41 from our website for free. The program's installer is commonly called Ladder Logic Simulator.exe. This free program is an intellectual property of Triangle Research International, Inc. This download was checked. Ladder Logic Program Runs Output Image (PLC Memory) State of Actual Output Device As the ladder logic program is scanned, it reads the input data table then writes to a portion of PLC memory - the output data, table as it executes The output data table is copied to the actual output devices after the ladder logic has been scanned.

What are the Ladder Logic Symbols?

Ladder Logic is one of the most common PLC programming languages. The standards of the language are well documented by the International Electromechanical Commission (IEC) in the exhibit 61131-3. However, official documentation of the ladder logic symbols isn’t easy to digest and doesn’t provide concrete examples of each one.

Ladder Logic symbols are foundational elements that are memorized by every plc programmer. They’re essential to know if you plan to do any work with this PLC programming language.

In this tutorial, we will discuss each symbol, the functionality it brings to the ladder logic plc programming language as well as illustrate two examples where they may be used.

Normally Open (NO) Contact / Examine if Closed (XIC)

The most fundamental symbol of ladder logic programming is the Normally Open Contact or the Examine If Closed XIC Instruction. This symbol was created as a direct reapplication of the relay-based contact used in early electrical drawings.

How does the Normally Open Contact Work?

Initially, the contact was tied to a coil of an electrical relay. When the coil of the relay was energized, the contact would close. The ladder logic symbol operates in the same way. It will specify a logical bit that can be set to 0 (LOW) or 1 (HIGH). Based on the state, the instruction will either evaluate to TRUE or FALSE. If the instruction is TRUE, it will let the current through and allow the PLC to evaluate the next instruction. If it’s FALSE, the ladder logic symbol will stop the execution there.

Practical Application of the Ladder Logic Symbol - NO Contact / XIC

Ladder

The Normally Open Contact symbol is prevalent in ladder logic. It’s the most basic logical check for most conditions in PLC programming.

1. Verification of an Input

The rung above is using the Normally Open Contact to verify the “PointIORack1:1:I.0” input. If the input is energized (HIGH), the condition indicates that the “Box Counter Photo Eye - No Box” is turned ON. In other words, there’s no box in front of the Photo-Eye present on the line.

2. Count Up Condition

The rung above is using the Normally Open Contact to enable the “BoxCounter” CTU instruction. Each time that the NO Contact transitions from LOW to HIGH, the counter will increment by 1. As shown in the rung, the counter has counted ten boxes and is now set to the .DN (Done) condition.

Normally Closed (NC) Contact / Examine if Open (XIO)

The opposite of the Normally Open Contact is the Normally Closed. This validation will look at the specified bit and evaluate to TRUE when the bit is de-energized and FALSE when it’s energized. The application would allow the user to check if the coil of the specified bit is de-energized and take appropriate action in ladder logic PLC programming.

How does the Normally Closed Contact Work?

The normally closed contact would also be tied to the coil of a solid state relay. When the coil has no current running through it, the contact would let current to flow through. However, when the coil would be energized, no current would flow through the contact. The NC Contact or the XIO instruction in PLC programming ladder logic would work the same way. In other words, the bit would allow the current to flow through when it’s LOW and no current would flow through when the bit is HIGH.

Practical Application of the Ladder Logic Symbol - NC Contact / XIO

The XIO is very common in the ladder logic plc programming language. It’s an instruction that allows us to examine the OFF state of a bit as described above. Here are two common examples of where this instruction is used.

1. Stop Button Condition

The rung above incorporates the normally open and normally closed ladder logic symbols. It creates a condition that will energize the GREEN_LIGHT_ON bit when the “START_PRESSED” is energized. However, the XIO is tied to two bits: STOP_PRESSED and RESET_PRESSED. When either one of these conditions is set to HIGH, the “GREEN_LIGHT_ON” bit will be set to LOW during the rung evaluation cycle.

2. Timer Continuous Latch

The rung above will allow the Timer to operate based on the HMI_Rotation_Enable condition. However, a typical timer would count until it reaches the “Preset” value. In the rung above, the timer will reset once the timer is set to .DN (Done) due to the XIO being tied to the same bit of the timer.

Output Energize (OTE)

When certain conditions are met, the system should take a certain action. Unlike the two symbols above, the output energize will be used to execute an action. Within the scope of an electrical diagram, this symbol would indicate that a coil of a relay needs to be energized when conditions are met.

How does the Output Energize Symbol Work?

The output energize ladder logic symbol will change the state of a bit based on the conditions specified on the left side of the rung. When the conditions are TRUE leading to the OTE instruction, the value of the specified bit will be set to HIGH or 1. When the conditions are FALSE, the OTE instruction will set the value of the same bit to LOW or 0.

Practical Application of the Ladder Logic Symbol - Output Energize

The OTE instruction is very common in ladder logic applications. As mentioned above, it’s used to drive outputs based on certain conditions. This translates to operating external PLC hardware such as relays, motor contactors, valves, cylinders, etc. By energizing the bit that is tied to the output, a PLC programmer can change the state of the output to the desired position.

1. Turn ON Light / Output

In the rung above that we’ve already seen, the output is energized when the conditions are met. The “GREEN_LIGHT_ON” bit is tied to an output of the PLC that will turn on an LED in the field. By using the Output Energize (OTE) Instruction, the PLC programmer will turn ON the light on the plant floor.

Ladder Logic Programming Language

2. Set the System to Faulted State

The following rung verifies one faulted condition: System 1 - Fault. When the system is faulted for that specific reason, the “RPiS_BOOL[5]” bit will be set to HIGH through the Output Energize (OTE) Instruction. Once the system is no longer faulted, the faulted status will remain ON until the Reset button is energized and validated through the XIO condition. The Reset will allow the OTE instruction to clear the bit and set the faulted state back to LOW.

Output Latch (OTL)

The Output Latch ladder logic symbol is not something that can be created with relay based logic. This instruction will permanently keep a bit set to 1 when the condition holds.

How does the Output Latch Symbol Work?

The output latch instruction will execute only when the preceding conditions are TRUE. If they are, the instruction will set the bit associated with the OTL to HIGH (1). If the bit is set to 1 or the conditions are no longer true, the bit will remain HIGH (1). This difference is important as the Output Energize (OTE) will set the bit back to 0.

Practical Application of the Ladder Logic Symbol - Output Latch

The OTL instruction is not commonly used in ladder logic programming. The reason is mentioned above: the instruction will not automatically reset the bit back to 0. This minor difference leads to code confusion and potential issues when it comes to executing, changing or evaluating conditions after implementation.

1. Fault Latching

Ladder Logic Program

As we discussed before, faults play a critical role in PLC programming. It’s important to properly detect, act upon and identify the faults occurred within the system. Once they occur, the user will throw the faults to the operator in order to troubleshoot. For that reason, it’s important to keep the faults in place until the system is audited and reset when deemed operational.

The rung above displays a condition in which we are required to clear a fault on a variable frequency drive PowerFlex 525. Once the fault is latched, the motor is kept in a faulted state while a separate routine takes care of safely stopping the drive. The OTL will set the bit to HIGH and wait until the fault is reset.

2. Condition Setting

In the rung above, the OTL instruction is used to open the valve of the riser. Although this could have been achieved through an output energize (OTE) instruction, we’ve decided to use the OTL due to a number of conditions that may set the bit RiserBOOL[0] to HIGH. Note that this routine also contains the OTU that will reset the bit back to LOW as needed by the PLC programmer.

Output Unlatch (OTU)

The Output Unlatch ladder logic symbol is often used in conjunction with the OTL. It’s a way to create a disable of the bit specified within the logic of the controller.

How does the Output Unlatch Symbol Work?

The output unlatch instruction will execute only when the preceding conditions are TRUE. If they are, the instruction will set the bit associated with the OTU to LOW (0). If the bit is set to 0 or the conditions are no longer true, the bit will remain LOW (0).

Practical Application of the Ladder Logic Symbol - Output Unlatch

The OTU instruction will have to be used with the OTL in order to reset the bit back to LOW as discussed above. Therefore, this instruction will be always found whenever the OTL is used. Let’s examine the same two examples, as we saw above.

1. Fault Latching

In the rung above, once the fault is cleared through the Reset_PB XIC instruction, the fault is unlatched using the OTU instruction. Notice that the unlatch is within the same branch as the PF1:O.ClearFaults instruction that will be energized once the reset is set.

Conclusion

The five most used ladder logic symbols are as follows: Normally Open Contact, Normally Closed Contact, Output Energize, Output Latch and Output Unlatch. These five instructions are commonly used in ladder logic for bit manipulation. The first two are conditional instructions that will allow the current to flow depending on the status of the bit. The last three are output instructions that will execute if the logic leading to them is TRUE. They will set the bit to either 0 or 1 depending on the instruction used.

What is Ladder Logic?

Ladder Logic is one of the top 5 most popular types of PLC programming languages used in manufacturing environments. Before Programmable Logic Controllers, manufacturing plants employed relay-based circuitry to energize different loads based on how the relays were wired together. Relays were costly, required constant maintenance, and could not be easily reconfigured. As PLCs took over this process, it was essential to keep a similarity of the old system; thus, ladder logic was created as the first PLC programming language.

Ladder Logic is labeled as such because the software is laid out in the shape of a ladder. On the left side, ladder logic instructions are set as conditions, while the ones on the right side are instructions that are triggered if the conditions are met. Each rung of the ladder spans from left to right and is executed from top to bottom by the PLC.

As mentioned above, ladder logic is extremely popular among PLC programmers. It’s easy to learn, mimics electrical circuits, and is easy to troubleshoot once deployed.

Learning ladder logic is typically the entry point into a career in control systems as a PLC programmer. In this post, we will go over ladder logic components, cover basic principles, and outline what it takes to master this programming language.

Ladder Logic Basics

Just like computers, PLCs operate with binary signals; each one can be set to zero or one. In the programming world, this data type is called a boolean. A boolean takes a single bit in the memory, can be set to 0 or 1, and is used in most basic PLC instructions.

The PLC executes the program loaded into it one rung at a time. As the PLC begins to process the rung, it reads the instructions on the left and determines if the Logic on that side of the rung is set to TRUE. The Logic evaluates to TRUE when a hypothetical current is able to pass through the instructions. Each instruction has a set of conditions that make it TRUE or FALSE.

For the purpose of this tutorial, we’ll start with two of the most basic instructions in ladder logic plc programming: Examine if Closed and Output Energize.

Examine If Closed [XIC] - This input instruction will look at the specified boolean bit and evaluate the condition to TRUE when the bit is set to 1 (or HIGH). While the bit is set to 0 (or LOW), the instruction will evaluate to FALSE.

Dummies

Output Energize [OTE] - This output instruction will set the specified bit to 1 (or HIGH) if the input instruction conditions are TRUE. If they’re FALSE, the Output Energize instruction will set the bit to 0 (or LOW).

Basic Ladder Logic Rung Analysis

  • Step 1 - The hypothetical current starts moving from left to right.
  • Step 2 - When the hypothetical current encounters and XIC Instruction, it checks if the condition is TRUE or FALSE. If the XIC is False, the PLC aborts this rung.
  • Step 3 - The hypothetical current goes to the next instruction. Repeats Step 2 until the rung is completed.
  • Step 4 - The PLC moves to the rung below.

In the example above, the XIC Instruction is tied to the bit “Condition1”. Since the bit is OFF (or 0), the hypothetical current stops at the instruction.

In the example above, the XIC Instruction is tied to the bit “Condition1”. Since the bit is ON (or 1), the hypothetical current is allowed to pass through and goes to the OTE Instruction. The OTE Instruction sets the “Energize1” bit to HIGH (or 1).

Ladder Logic Structure | Circuit Branches

Now that we’ve seen a basic example that illustrates how the execution of a single ladder logic rung is completed, it’s time to discuss circuit branches. Circuit branches create a way for the current to pass through a different path as the rung executes. The instructions are executed in the same way, but we now need to analyze different paths the current may take.

The rung above has the primary rung and a branch that jumps the first two conditions with a 3rd one. Let’s analyze what’s happening with the execution of the Logic.

  • Step 1 - The hypothetical current starts on the main branch of the rung. As it reaches “Condition1”, it evaluates the XIC Instruction. The XIC Instruction is TRUE and allows the current to proceed.
  • Step 2 - The hypothetical current flows to the next XIC Instruction and attempts to evaluate it. Since “Condition2” is set to 0, the XIC Instruction evaluates to FALSE. The current is stopped.
  • Step 3 - The hypothetical current goes back to the first branch. The XIC Instruction tied to bit “Condition3” is executed. Since the “Condition3” bit is HIGH, the XIC evaluates to TRUE. The current proceeds.
  • Step 4 - The current reaches the OTE Instruction and sets the “Energize1” bit to ON (or HIGH).

Here's a much more complex example for you to consider. It's not abnormal to find multiple branched circuits in ladder logic.

Advanced Circuit Branching Ladder Logic Practice

Now that you’re familiar with how circuit branches work in ladder logic, it’s important to practice tracing the logic as you would in the field. Most of your work as a PLC programmer is going to be looking at rungs of logic and figuring out why the output is energized or what’s preventing it from turning on.
Consider the following situation: your supervisor calls you due to a problem on a production line. For some reason, the pump that’s going to deliver raw materials to a specific tank isn’t turning ON. As you show up to the operator station, he shows you that when he pushes the button, the pump won’t do anything.
Resolution: you look at the panel, press the button yourself, and confirm that it doesn’t start. This pump worked in the past, so you decide to see what’s happening in the PLC logic. As you trace the output tied to the pump, you notice a complex rung with multiple circuit branches. The reason is that there are numerous conditions for that pump to start. Since you’re familiar with the approach above, you can quickly figure out that the pump wasn’t able to start because one of the start conditions was that the tank must be empty. As you realized that the tank was, in fact, empty, the conclusion was that the level sensor was broken. You replaced the sensor, and the pump resumed regular operation.

Ladder Logic RSLogix 5000 Components

Now that we have some familiarity with how a basic rung structure is laid out, let’s discuss other components of ladder logic.

1 - Ladder Logic Inputs

Ladder Logic Program

As we discussed above, the ladder logic instructions on the left side are called inputs. Their condition is evaluated on a true or false basis. If the evaluation is concluded with a TRUE, the output of the ladder logic rung is executed. If it's evaluated to FALSE, the PLC goes to the following rung.

2 - Ladder Logic Rung Comments

Every programming language allows the user to add documentation to their software. In ladder logic, this opportunity comes with every rung, instruction and data structure. By adding a comment above the rung, you're making it easier for the person after you to understand your train of thought and troubleshoot the logic as needed. Furthermore, the comments may be used to indicate a change or temporary fix of a certain problem that was encountered by a PLC programmer.

3 - Ladder Logic Outputs

There are many instructions that will execute on the output side. In the example we covered above, our focus was on the OTE Instruction. However, the screenshot above also includes TON or Timer On Delay Instructions. As you gain experience as a PLC programmer, you'll encounter and master additional instructions.

Ladder Logic Programming Books

4 - Ladder Logic Rails

Each rung of ladder logic lies between the two side rails (just like a regular ladder). These rails are what energizes each rung as they are executed. In the screenshot above, you can see two rails within the RSLogix / Studio 5000 environment. The rails remain grayed out until the main routine calls the program. In the screenshot, the rails are green, which means that this specific logic is being executed.

5 - Tag Names

Each instruction will be tied to one or more tags. Each tag requires a data structure element as well as a name or label. In the examples we looked at above, tags were labeled as 'Condition1', 'Condition2', 'Condition3', etc. In production circumstances, tags would typically reflect the physical element they control or a set of PLC based tags. For example, tags that control motors may have the label of MTR1_Start, MTR2_Stop, MTR2_Status, etc. Furthermore, tags may also have a description that allows the user to give the tag a text-based description.

Ladder Logic Programming in RSLogix 5000 Basics

As you invest yourself in PLC Programming, you'll quickly realize that the list of different instructions available to you is vast. Furthermore, as you become advanced at the craft, you may find yourself creating your instructions through the use of an Add-On-Instruction or AOI. However, assuming that you're here for the basics, let's discuss the most useful instructions you should start working with as you tackle industrial automation.

Examine If Closed [XIC]

We've looked at these instructions at the start of the tutorial. It's the essential input check you can make on your data. In short, if the boolean assigned to the XIC is TRUE, the output will go through. If it's FALSE, it won't. Although it may seem that this would have limited utility, many of the advanced constructs within PLCs have a boolean state. For example, a Variable Frequency Drive may have an array of boolean structures that are tied to different faults. Therefore, you may create the same number of XIC instructions to verify which failure is present on the drive.

Examine If Open [XIO]

Ladder Logic Programming Pdf

The XIO will energize the output if the exact opposite of the XIC is true. In other words, the output will energize if the boolean value is FALSE.

Output Energize [OTE]

The OTE is an output instruction and will set a boolean to TRUE if all the preceding conditions are TRUE leading to it. The OTE would also set the boolean to FALSE should there be no TRUE path of inputs leading to it. The Output Energize instruction is used to set digital outputs on field devices such as valves, motor contactors, relays, solenoids and more.

Timer ON [TON]

Timers are a basic>

  • The stop push button should prevent the motor from getting started.
  • The stop push button should stop the motor when it's running.
  • Based on the two requirements above, it's possible to add an XIO instruction into each branch of the circuit. However, ladder logic is such that the user can utilize a single instruction to cover both of those scenarios after the branch.

    Example of a functionally sound rung based on the above requirements.

    The rung above will operate as expected. However, it's important to create efficient ladder logic and utilize instructions in conjunction to the branch structures we've covered above.

    The rung above operates as follows:

    Stage 1 - The Start_PB is pressed and the MotorContactor is Energized while Stop_PB is not pressed.

    Stage 2 - The MotorContactor bit is used to keep the motor energized while the Start_PB is released.

    Stage 3 - The MotorContactor is de-energized when the Stop_PB is pressed.

    The motor starter ladder logic example is easy to follow. However, as you expand your knowledge of ladder logic principles, you will create complex branches around similar circuits. It's not uncommon to have multiple stop conditions that are set in series with the 'Stop_PB' bit. Similarly, it's common to see other sources of starting the motor. For example, a sequence may be used to start a specific pump through software.

    Conclusion

    Ladder Logic is the most common PLC Programming language. It's easy to learn, easy to use and has been adopted since the early days of Programmable Logic Controllers. The iconic resemblance to a ladder was what gave this type of logic its name. Such diagrams were used for specifying electrical drawings that were used in many industrial environments. Since those days, ladder logic has involved significantly, yet retains some of the basic elements: rails, rungs, input conditions, output instructions, comments, etc.

    To learn ladder logic, you'll need to start with understanding current flow from the left rail to the right one. In summary, the current will attempt to flow through one rung at a time. As it encounters an input condition, it evaluates the result to TRUE or FALSE. If the condition is FALSE, the current will atempt to use a secondary path which may be through a circuit branch. If the result is TRUE, the current will proceed through the instruction. When it reaches an output instruction, it will execute the specified logic.