TL;DR: Popular PLC Programming Languages
- Ladder Diagram (LD)
- Function Block (FBD)
- Structured Text (ST)
- Instruction List (IL)
- Sequential Function Chart (SFC)
The majority of PLC programs use only one programming language to complete the task at hand. Just because there are five options, doesn’t mean you need to know and incorporate all of them in a project. The vast majority of factories and automation projects only use one language. We’ll take a look at each of the PLC programming languages, starting with the most popular choices and working our way through the list.
1. Ladder Diagram (LD) or Ladder Logic
The first IEC 61131-3 language is Ladder Diagram (LD), which is commonly referred to as Ladder Logic. It’s the most popular PLC language because it was designed to replace hardwired relay control systems. If you’re to learn any of the languages, I highly recommend starting with the Ladder Diagram language because it’s easy to read, comment, and debug while your system is online. Ladder Diagrams has limitations because you can only use the blocks that are defined. Plus, it’s not great for motion control; however, you can get away with writing the majority of your control systems using Ladder Diagrams alone.
Ladder Diagram is read from left to right and top to bottom. All of the contacts on the left must be true in order to energize the output coils. If you have a basic understanding of digital logic and conditional statements, Ladder Logic is pretty easy to pick up. For more complex systems, LD can be challenging to interpret, but the online debugging tools make it easy to track down faults, and correct issues.
2. Function Block Diagram (FBD)
The second most popular PLC programming language is called Function Block Diagram (FBD). In Function Block Diagram, program blocks are connected together to create a program. A lot of the same commands used in Ladder Logic are used in FBD, but it is often easier to read and conceptualize. An added benefit to using Function Block Diagram is that you can consolidate many lines of code into a single block.
Depending on the size of your system, FBD may or may not be the optimal choice. If your system requires a lot of motion control planning and repetitive tasks, then FBD could be the straight forward approach. However, if you have a lot of code to create, you’ll have to take a few extra steps to keep the Function Block Diagrams organized. Because you can place blocks anywhere, these diagrams can get messy, and disorganized fairly easily.
3. Structured Text (ST)
Third, on the list of PLC programming languages is Structure Text (ST). Structured Text looks very similar to BASIC or C programming. It’s best used for control systems that require mathematics or complex tasks. Trigonometry, calculus, and data analysis can be implemented far easier in this language than in Ladder Diagrams. Becuase ST isn’t a graphical language, it also runs faster and requires less space.
If you come from a traditional programming background, you can become proficient in ST faster than Ladder Logic or the other graphical PLC programming languages because the commands have a similar structure.
4. Instruction List (IL)
Next is Instruction List (IL). This programming language consists of many lines of code, with a single instruction per line. It’s read top to bottom and left to right. Instruction List is very straight-forward to read because each line is executed sequentially. Once you learn the mnemonic codes (Load = LD, Start = ST, etc.), Instruction List a great language to add to your arsenal because you can create compact and time-critical code as required by your application.
On the other hand, Instruction List can be trickier to debug and resolve errors than some of the other languages. It’s also a bit limited when it comes to structuring code because “GOTO” is just about all you can do to jump out of the list and run additional commands.
5. Sequential Function Chart (SFC)
Lastly is Sequential Function Chart (SFC). The concept of SFC is simple: an action box is active until the transition step below it activates. The transition step contains all of the conditions that must be met in order for the next box to activate. If you’re working on a project that has repeatable steps that can be broken into smaller tasks, then SFC is the easiest of the languages to implement.
The advantage of using the Sequential Function Chart is that you can break large processes into major steps, write the action box in whatever language you like, and then run your code sequentially based on the current state of the system. SFC also great for real-time debugging because you can see exactly where the fault happened and figure out what to do to fix it.
How to choose which PLC programming language to learn?
The answer to this question is going to depend on a couple of things:
- What language your workplace or lab uses currently;
- The application you’re designing;
- The PLC brand you have and the software packages you have access to; and
- Your career scenario.
Let’s take a look at each of these points in more depth.
1. What PLC language your workplace uses
Typically, if you work in a factory or in a lab with PLCs, there’s already a universal language that everyone is expected to use. Most of the time it’s Ladder Diagram, regardless of the application. If you’re getting into PLCs because your job demands it, I highly recommend figuring out what language(s) the equipment uses already and then becoming familiar with those first. It doesn’t make sense to learn ST if all of your machines run LD.
2. The Automation Application you’re designing
Secondly, if you work for an Automation, a Systems, or a Machine Integrator, you might be required to know all five IEC 61131-3 languages and choose the best one based on the customer’s application. As mentioned above, each of the PLC programming languages has its advantages and disadvantages depending on what you’re trying to do. Some customers might require that their machine is written in a certain PLC programming language so that their maintenance staff can debug and maintain the equipment after it’s installed. It’s a good idea to check with the contract requirements to ensure that you’re writing the code in the correct language.
3. The PLC brand you’re using
Lastly, if you’ll want to figure out what PLC you’re using and what language(s) it supports. Some PLCs only play nice with Ladder Diagram. Some PLCs and PACs support all five IEC 61131-3 languages. Even if your controller supports the language, you’ll want to make sure that your programming software has the capability to write that language. Ladder Diagram is a default option, the majority of the time. Some brands require add-on packs for using additional languages. Consult with the software and your brand’s documentation to figure out which language is best suited for your system.
4. Your Career Path
Furthermore, if none of those points are applicable to you because you’re just trying to advance (or start) your PLC programming career, then I recommend learning the most popular PLC languages (LD, FBD, ST) and then working your way through Instruction List and Sequential Function Chart. You don’t need to be a master at every PLC language. If you know LD very well, then you’ll be ready to tackle about 80% of the automation projects out there today. It’s more about having a solid foundation in how to develop an automated system. Translating it into a different language is secondary, so long as you understand at least one language very well.
Places to Learn PLC Programming
There are a bunch of resources to learn PLC programming including vendor training, online courses, and YouTube. I’ve found that vendor training (like Rockwell’s ControlLogix training) is very useful, but only if you attend them in the order in which they should be taken. Vendor training can be thousands of dollars, so if you’re looking to fund your own PLC development plan, I recommend a few Udemy Courses to get you started.
It’s important to know what controller you want to program before diving into training. It’s great to take a Rockwell class, but not if you’re going to be programming Siemens PLCs. While the languages are the same, the programming environments are different, and some of the nomenclatures are brand-specific, too. While training won’t make you a PLC programmer in a day, it can provide the necessary structure that’s inevitably required to be successful in the Industrial Automation field.