The 5 most popular types of PLC programming languages defined by the IEC 61131-3 standard are:
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.
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].
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.
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.
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 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.
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 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 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.
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 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 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.
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.
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.
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.
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.
Get started with PLC programming with our forever free courses