PLC Programming Languages: Go Beyond Ladder Logic

PLC Programming Languages: Go Beyond Ladder Logic

 

You’ve probably heard of Ladder Logic, the ubiquitous PLC programming language favored by many industrial professionals. But how much do you know about the four other common PLC programming languages? The reality is that most industrial organizations have PLCs programmed in different languages. By learning more about all of these languages you’ll be able to expand your PLC programming skills, and will get a leg up on programmers who are less flexible.

This blog post offers an overview of all five of the programming languages defined in the International Electrotechnical Commission’s (IEC) standard, IEC 61131-3. Before we dive into the different programming languages, let’s take a quick look at what PLC programming itself is.

 

What Is PLC Programming?

PLC programming is the act of creating instructional code for a Programmable Logic Controller (PLC) to follow in order to automate industrial processes. The steps to program a PLC are:

1) Map out how the system will function
2) Use a PLC programming language to write the instructional code
3) Test, troubleshoot, and debug the code
4) Download the program onto a PLC and verify it works properly

A PLC will use the program’s logic to determine if it should change the state of an output depending on the state of an input, the status of a timer, a combination of several input states, etc. For example, a PLC programmer may include directions to turn an alarm (output) to “ON” when a tank temperature sensor (input) exceeds a certain temperature.

 

What are the 5 Types of PLC Programming Languages?

The five PLC programming languages defined in the IEC’s standard are:

Each of these languages falls into one of two categories: graphical or textual. Graphical languages are crafted with visual elements, whereas textual languages use strings of text.

For each language, we’ll go over its basic architecture, the benefits of using it, and some use cases that are best suited for it. Let’s kick things off with the popular Ladder Logic.

 

PLC Ladder Logic Example

 

Ladder Logic

Ladder Logic, also known as Ladder Diagram, is a graphical PLC programming language based on relay logic’s circuit diagrams. Ladder Logic consists of two parallel bars connected by a series of rungs, resembling a ladder in appearance (hence, the name). There are contacts and coils on these rungs, which symbolize inputs (such as a sensor value) and outputs (like a motor run command) respectively.

The vast majority of control system programming in North America uses Ladder Logic, and for good reason. It’s flexible, versatile, simple to troubleshoot, and easy to learn. One drawback, however, is that once a ladder hits a certain amount of rungs, it can become unwieldy and need to be split into multiple ladders for maintainability.

State machines, PID control, and systems with an abundance of Boolean algebra are some use cases that are well-suited for Ladder Logic.

 

PLC Function Block Diagram Example

 

Function Block Diagram

Function Block Diagram (FBD) is another popular graphical PLC programming language. It consists of various kinds of blocks that have inputs and outputs. Devices connected to the PLC can be linked to an input, and variables can be sent to an output. Additionally, blocks connect to each other — the output of one block can feed into another block’s input. These blocks are what define the functions of a system.

The FBD language is relatively simple, though it does require some training to use. It’s a great choice for safety PLCs, PID loops, and when you need to do encapsulation, reuse code frequently, hide or preserve data, or do analog input filtering.

 

PLC Sequential Function Charts Example

 

Sequential Function Charts

Sequential Function Charts (SFC) is a graphical PLC programming language based on GRAFCET, and resembles computer science algorithm flowcharts. SFC consists of steps and transitions. Steps are the actions to be performed, and transitions are the logic conditions that need to be met before moving on to the next step. Due to the nature of this architecture, SFC controls a program’s operational flow.

A major benefit to using SFC is how it can simplify a complicated process by dividing it up into more manageable parts. It also can be easier to test and troubleshoot than some of the other languages here. SFC is ideal for complex multi-state processes, linked processes, when there are multiple processes to be run in parallel or sequentially, and batch production.

If you’re looking to create SFCs outside of PLCs, and want to run them in your Ignition software, Inductive Automation’s SFC Module streamlines SFC with features like chart monitoring, hot editability, and a drag-and-drop programming tool that lets you easily create complex charts.

 

PLC Structured Text Example

 

Structured Text

Structured Text (ST) is a high-level PLC programming language. It’s a textual language, with syntax comparable to C or C++, so those who have studied these types of computer programming languages will have an easier time with it. In ST, statements (such as IF, for example) are used to perform functions.

ST is a concise language that executes quickly and can be read without much difficulty. Troubleshooting it, on the other hand, can be a more involved process, since the states of variables aren’t easily discernible. This language is best for doing things like barcode parsing, looping, manipulating data, bridging the gap to machine code, complicated math, or searching data.

 

PLC Instruction List Example

 

Instruction List

Instruction List (IL) is a low-level textual PLC programming language. Instruction List was deprecated in the IEC’s standard, which means it’s doubtful that new PLCs will be programmed with it. Since some current PLCs may still use IL, however, it’s helpful to know what it’s all about.

IL consists of a simple series of instructions and is similar to assembler language. “Jump” or “store” are examples of some of the common commands you’d use in Instruction List. Due to the deprecation of IL, if you’re considering using it for new programs, you should opt for Structured Text instead.

 

A Few Notes

We’ve highlighted some common use cases for PLC programming languages above. However, please note that these use cases are done in other languages as well. Take PID loops as an example – while we only highlighted them in Function Block Diagram, they are used in all five languages.

Another thing to note is that some programming software has licensing restrictions which may limit access to Sequential Function Charts, Function Block Diagram, and/or Structured Text.

So, how do you determine which language is best for your project? At the end of the day, all of the languages above can accomplish anything that a PLC is capable of. Because of this, the choice of which language to use often depends on practical considerations for deployment and maintenance. It’s important to take into consideration who will be maintaining the program, customer preferences, and the skill set of the programmers, engineers, and maintenance personnel.

 

Ignition Helps You Do More With PLCs

The Ignition industrial application platform can work with any kind of programmable logic controller utilizing any of the PLC programming languages. It also allows connections and communication across different brands of PLCs seamlessly. This freedom allows you to break out of the Ladder Logic box and choose the best language(s) and hardware for your project.

Now that you have good foundational knowledge about different PLC programming languages, you can begin diving deeper into each one. To get started, check out the Inductive University video lesson, Introduction to Sequential Function Charts, which offers a solid introduction to SFCs in under three minutes, and includes an example chart of a basic batch process.

And if you’re interested in learning how to improve communication with PLCs, watch the Ignition Community Conference session, 3 Tips to Evolve Your Ignition System's Communication to PLCs, for some expert advice.


AUTHOR
Jennifer Faylor
Marketing Content Writer / Inductive Automation
Jennifer Faylor is a Marketing Content Writer at Inductive Automation. She has an M.F.A. in creative writing from Sarah Lawrence College and previously worked as a freelance writer/editor for over a decade. In her free time she enjoys writing poetry and embarking on culinary adventures in the kitchen.
Table of contents