Cookies are important for this site to function properly, to guarantee your safety, and to provide you with the best experience. By clicking OK, you accept all cookies. For more information, please access our Privacy Policy.
Learning

Top 5 Most Popular Types of PLC Programming Languages

A complete guide to the five most popular PLC Programming Languages: Ladder Logic, Structured Text, Function Block Diagrams, Sequential Flow Charts, and Instruction Lists.

PLC Programming Language Specifications

The 5 most popular types of PLC programming languages defined by the IEC 61131-3 standard are:

  • Structured Text (ST)
  • Sequential Function Charts (SFC)
  • Ladder Logic Diagram (LD)
  • Function Block Diagram (FBD)
  • Instruction List (IL)

The International Electrotechnical Commission 61131-3 outlines 5 different PLC Programming languages: ladder logic, structured text, function block diagrams, sequential function charts, and instruction lists. Each one of these languages has advantages, weaknesses, and best use cases. As a competent PLC programmer, it’s essential to be aware of these options to troubleshoot existing code, utilize the right tool for the job, and have a different perspective on how problems may be solved. Furthermore, depending on the PLC platform of choice, specific languages may come at a premium or not be available at all. For example, only the full license of RSLogix 5000 will have access to languages beyond Ladder Logic.

Let’s take a more in-depth look at each one of these languages, go over their applications, general structure, and use cases.

What is the most popular programming language for a PLC?

This question is debated among PLC programmers across the world. The consensus is that the most utilized language for PLC programming is ladder logic. This is due to the fact that it's highly flexible, easy to learn and very well understood by electricians who have worked with schematics that model the same architecture.

However, over the last decade, a younger workforce has entered manufacturing. These engineers and technicians have been primarily taught modern languages such as Java, Python and Javascript. These languages have a closer resemblance to Strcutured Text [ST] and thus promote its usage.

It's also important to consider the industry at question. A chemical process is typically designed used Piping & Instrumentation Diagrams (P&ID). These specific schematics are easily replicated through the use of Function Block Diagrams [FBD].

PLC Programming Languages - An example of a chemical process that would be easier to implement in Function Block Diagrams (FBD) PLC programming
PLC Programming Languages - An example of a chemical process that would be easier to implement in Function Block Diagrams (FBD) PLC programming

Ladder Logic PLC Programming

Before Programmable Logic Controllers became popular, relay-based controls were the norm at most manufacturing sites. Relays drove loads based on the simple logic that was implemented through the physical wiring of the devices. The wiring of these devices was specified in electrical drawings that assumed the layout resembling a ladder. As the most basic PLCs were introduced into the field, ladder logic PLC programming was designed to mimic the layout of relay-based circuits. In other words, ladder logic was one of the first PLC programming languages that’s still used today due to simplicity.

PLC Programming Languages - PLC Schematics Leading to Ladder Logic PLC Programming
PLC Programming Languages - PLC Schematics Leading to Ladder Logic PLC Programming


Since its inception, ladder logic has evolved significantly. However, the basic principles of operation remain the same. Ladder logic PLC programming evaluates each rung of a ladder in sequential order assesses conditional instructions, and if the result evaluates to “TRUE,” the output instructions are executed.

PLC Programming Languages | Ladder Logic PLC Programming Example in RSLogix 5000
PLC Programming Languages | Ladder Logic PLC Programming Example in RSLogix 5000

Advantages of Ladder Logic PLC Programming

  • Simple to Implement and Troubleshoot | Ladder Logic is a visual language that provides confirmations of status for most instructions. In other words, it’s easy for someone with little knowledge of a specific process to walk through the program and understand the logic.
  • Modular Design | Ladder Logic can be easily modified through the addition or subtraction of logic. Each rung is a separate condition and can be removed or added as needed.
  • Resilience and Consistency | Ladder Logic allows the user to implement many functions. However, the language is heavily standardized and doesn’t give full flexibility, thus keeping the code consistent between different implementations.

Drawbacks of Ladder Logic

  • Steep Learning Curve | Ladder Logic is a simple language, yet not very intuitive to those who come with backgrounds in C, C++, Java, or Python. That being said, it may be easier to grasp for electrical engineers and those with basic knowledge of assembly programming.
  • Slow Deployment | Because of the visual nature of ladder logic, it takes longer a programmer to create the logic they’ve envisioned. There’s a need to drag and drop elements that slow down the development process versus other modern programming languages.
  • Unintuitive for Complex Applications | Ladder Logic shines when it comes to sequential boolean tasks. However, when it comes to modern control theory that involves PIDs, flow control, analog sensors, and feedback loops, it’s not always easy to implement and decipher.

Ladder Logic is the most used PLC programming language around the world. It’s easy to work with and maintain for those who don’t have constant exposure to PLC programming. We recommend that you begin your PLC programming journey by learning ladder logic first.

Structured Text PLC Programming

Structured Text is a PLC programming language that closely resembles C or assembly. The user enters lines of code that execute sequentially, evaluate specific functions, boolean checks, and energize appropriate outputs of the PLC. Structured Text provides a simple transition into PLCs for those who have a background in a traditional programming language such as C, C++, Java, or Python. Furthermore, it can be easily manipulated in text processors, thus making it fast to implement without the need for hardware.

Structured Text PLC Programming | Example in Studio 5000 CompactLogix PLC
Structured Text PLC Programming | Example in Studio 5000 CompactLogix PLC

Advantages of Structured Text PLC Programming

  • Intuitive to Other Programming Languages | As mentioned above, Structured Text is easy to learn for those who are looking to transition from a software engineering background. It features the same structures, programming paradigms, and functions that one would expect to see in C or Java.
  • High Complexity | Structured Text allows for greater flexibility than other languages and thus makes it easier to implement advanced functionality for those who master the language.
  • Transferability | Structured Text is standardized among most PLC systems, thus making it easy to migrate between platforms. You’ll find significant differences in other languages between platforms, yet structured Text can be implemented in hardware and software platforms.

Disadvantages of Structured Text

  • Difficult to Troubleshoot | When compared to ladder logic programming, structured Text is much more complex from a troubleshooting standpoint. There are no visual queues, less visual aids, and typically more code on a single line. Those who aren’t comfortable with this language will have a hard time figuring out the process flow.
  • Error-Prone | Structured Text provides greater flexibility to the user. However, this flexibility comes at the cost of standardization. Users must use software engineering best practices to create safe fallbacks and trap any potential failures of the software.

We typically recommend that you learn Structured Text only after you’ve mastered Ladder Logic unless you have a background in another programming language. It’s not often seen in production environments due to the drawbacks mentioned above. However, it’s an excellent way to manipulate data, implement FOR loops and other structures that require extra steps in Ladder Logic.

Function Block Diagrams PLC Programming Language

Function Block Diagram, of FBD,  is a programming language developed with chemical processes in mind. It allows the user to create a visual representation and flow of the process with appropriate transitions between the instructions. The visual editor is user friendly, intuitive, and creates a natural way to implement specific flows.

The most common application we’ve used Function Block Diagrams in our PLC programs is to establish PID controllers. The visual aspect of FBD makes the PID easy to implement, visualize, tune, and troubleshoot in the field.

Function Block Diagram PLC Programming | Analog Signal Scaling Example in RSLogix 5000
Function Block Diagram PLC Programming | Analog Signal Scaling Example in RSLogix 5000

Advantages of Function Block Diagrams PLC Programming

  • Flexible Visual Editor | The editor for Function Block Diagram programming is very user friendly and provides a simple way to create any layout.
  • Ideal for Complex Programming Structures | In ladder logic, the user will have to use multiple rungs for what’s possible to accomplish on a single page of FBD. The instructions can be brought directly into complicated PLC Instructions that implement PID loops, Motion Control, and Add-On-Instructions (AOIs).
  • User Friendly | The visual editor of FBD, comes naturally for most users. The layout of the process can be re-created through a drag-and-drop methodology that leaves little to guesswork.

Disadvantages of Structured Text

  • Hard to Standardize | Due to the flexibility in the layout, it’s challenging to standardize programs written in FBD. Each PLC programmer will have an approach that’s different from others. Those who come behind will have a hard time understanding the flow of information.
  • Troublesome at Scale | FBD shines when it comes to small implementations of specific areas of a process. However, as the program becomes complex, it’s easy to get lost in all the sheets.

Function Block Diagrams are critical in analog scaling, PID loops, and Motion Control sequences. As you learn about these topics, you should start exposing yourself to this type of PLC programming. Before then, we would recommend mastering ladder logic.

Sequential Function Charts PLC Programming Language

As the name implies, sequential function charts, or SFC, shine when it comes to a subsequent process. For those who aren’t familiar with this notion, an example would be a chemical transformation from raw materials into the finished product. Let’s take a simple brewing process as an example.

Picture a large beer brewing facility with numerous tanks, valves, pressure sensors, heating elements, and a packaging section. When an operator initiates the production of a new batch, the process goes through the following sequence of steps. Note that these steps are simplified.

Step 1 - The system is verified for readiness. Are all the appropriate ingredients available? Are the tanks empty? Are the valves in the right state? If the answer is valid to all checks, proceed. If not, abort.

Step 2 - Initiate a tank filling sequence that may call on multiple ingredients (water, sugar, salt, yeast, etc.). Validate the state and proceed once the tank is full.

Step 3 - Initiate the brewing process. Raise and maintain the temperature for a specified period. Monitor tank pressure and react accordingly. Add ingredients if necessary. Proceed to the next step after brewing is complete.

Step 4 - Initiate transfer to holding tank. Our batch is ready; verify that all the appropriate valves are set to the right position, the holding tank is empty and begin the transfer process.

Step 5 - Transfer the batch to the bottling facility.

As you can see from the example outline above, the process steps are executed in a sequence, have defined start conditions and flow as the process would run in the production facility. In ladder logic, this process can be implemented through an SQI/SQO Instruction. However, a better approach would be to utilize SFC.

Sequential Function Charts PLC Programming | Sequential Process Example in RSLogix 5000

Advantages of Sequential Function Charts PLC Programming

  • Mimic Process Flows of Most Chemical Processes | Batching is a common chemical process approach that takes a set number of raw ingredients and transforms them into the final product. SFCs shine in these applications.
  • Combined with ST | Most SFC editors allow the use of Structured Text in specific cases to create advanced logic flows.

Disadvantages of Sequential Function Charts

  • Inapplicable in Most Applications | It’s challenging to apply sequential function charts to a process that isn’t sequential. In other words, it has a limited number of use cases.
  • Parallel Flows are Difficult to Implement and Troubleshoot | You may implement an unlimited amount of process flows through SFCs. However, as the process paths split into multiple flows, it becomes difficult to implement separate flow paths that would result in a robust sequence.

Sequential Function Charts are extremely useful in specific cases. However, trying to fit this type of programming language into a case that isn't sequential quickly leads to frustration. As you work in a manufacturing environment, we recommend that you become familiar with the process, understand the flow of the product and seek to build a model on paper before diving into SFC programming.

Instruction Lists PLC Programming Language

Instruction Lists are often confused with Structured Text due to their similar editors. These two PLC programming languages are typically seen on different platforms as their flow is similar. For example, Codesys based controllers would allow users to implement logic in Instruction Lists, while RSLogix 5000 based controllers only have access to Structured Text.

In terms of program flow, each line specifies instruction as well as the conditions and outcomes of the execution. In many aspects, Instruction Lists are closer to how you’d implement ladder logic programs than structured text. However, either language is capable of creating the same process flow.

Advantages of Instruction Lists PLC Programming

  • Highly Standardized | Instruction Lists follow a tight structure that requires the user to create variables explicitly, specify conditions, and list every instruction. There’s little variation between program implementation which leads to easy to understand code.
  • Instruction Focused | As the name would suggest, there’s a high level of importance placed on instructions rather than data flow. This style of programming creates a level of clarity of how data is processed in the program.

Disadvantages of Instruction Lists

Unavailable on Most PLC Platforms | As mentioned above, Instruction Lists aren’t a popular method of programming as they come unnaturally to most programmers. They’re closer to what one would see in assembly rather than any other programming language on the market.

Can Python be used in PLC Programming?

Yes, Python can be used in PLC Programming. You'll find that many PLC vendors, or OEMs, have added this feature in the recent years. Most PLC models will provide a way for the programmer to add applications written in languages that aren't standard to the IEC 61131-3 standard.

Advantages of Using Python for PLC Programming

Python is a popular scripting languages that gained popularity in the recent years primarily due to its extensive use in the machine learning applications. It's a loosely typed language that is easy to learn, easy to extend, and lends itself well for a variety of use cases. The advantage of using Python for PLC programming is the ability to leverage a variety of libraries that you won't typically find in industrial automation.

Conclusion

The five most popular PLC Programming Languages are Ladder Logic, Structured Text, Function Block Diagrams, Sequential Flow Charts and Instruction Lists. These methods of programming are available on most platforms. However, certain PLCs will restrict user access to certain languages unless the user pays a premium.

We recommend that every PLC programmer starts with ladder logic as this method is most common in the industry. That being said, as the person is exposed to advanced programming methodologies, it's important to learn the other languages that may provide an easier way to implement specific processes.