IEC 61131-3 Choosing a Programming Language

IEC 61131-3  Choosing a Programming Language

This is part two of my series on the IEC-61131-3 programming standard. Here's a link to Part 1 for those of you that missed it.

The IEC61131-3 standard contains 5 different programming languages. This article will give a brief introduction to each one and some tips on choosing which language is best.

The five languages:

Ladder Diagram is most popular in the USA. It is based on the graphical presentation of Relay Ladder Logic. Most non-IEC61131-3 compliant PLCs only support ladder logic.

Ladder Logic Programming Language

Instruction List is the European counterpart to Ladder. As a textual language, it resembles assembly code.

Instruction List - STL

Function Block Diagram expresses the behavior of functions, function blocks and programs as a set of interconnected graphical blocks, like in electronic circuit diagrams.

Function Block Diagram - FBD

Structured Text is a very powerful high-level language with its roots in Ada, Pascal and “C”. It can be used for the definition of complex function blocks, which can be used within any of the other languages.

Structured Text - ST - SCL

Sequential Function Chart (SFC) is a powerful graphical technique for describing the sequential behavior of a control program

Sequential Function Chart - SFC

So which one should you choose? The choice of programming language is dependent upon the following:

  • The programmers’ background
    • Are they better/faster at programming and debugging a particular language
  • The end user’s preference
    • As consultants, we often select a language based upon our customer's skill set. If they prefer one language over another, we will use it even if it would not have been our first choice.
    • Code that is easy to maintain may be much better than code that was easy to write in the first place
  • The task at hand
    • Ladder, Instruction List, and Function Block Diagram are work well for bit logic.
    • SFC is great for sequential operations.
    • Structured Text is perfect for complex math functions, array operations, and string operations.
    • Instruction List is well suited for low level processor commands and PLC memory/register access.
  • The way in which the logic is defined
    • If your pseudo code is written as a graphical flow chart, SFC is a good choice.
    • If your logic is defined as a stateless system where the outputs and inputs are linked with interlock logic, then Ladder is a good choice

If you are still unsure of which language to choose, here's a secret: YOU DON’T HAVE TO CHOOSE! That’s right, the great thing about the IEC61131-3 standard is that you can structure your project and mix and match programming languages.

If you structure your code properly and leverage the power and flexibility of function blocks (you do use function blocks, don't you?), you can modularize your code into manageable blocks. Each block can be written in a different language. You can choose which one is most suitable for each section of the project. For example: Basic I/O logic could be written in Ladder, main control and sequential operations in SFC, and data processing in ST. This way you can maximize the benefits of each language without having to choose one over another.

In the next segment, I'll be writing about what I believe to be the most important and powerful feature of the IEC61131-3 standard: Function Blocks!

Learn more about DMC's PLC programming services.


Mary StJohn
Thanks for the great posts! What about CFC? I notice it's not part of the standard, but does seem to be popular with CODESYS?
I find that I like function block code for process control.

You should do a blog on add-on instruction (AKA user defined function blocks).
Ken Brey
I just want to give an extra push for what I think is an under-utilized language: SFC. Although SFC stands for Sequential Function Chart, but it is not limited to processes that can be thought of as "single threaded". With SFC, you can spawn parallel branches and merge back to a single branch once both branches are complete. It is extremely versatile and especially great for processes involving motion.
Kelli: PLC Programming
Thanks for the run through of the IEC61131-3 standard. I thought that I was fairly familiar with it, but I found that after reading through your explanation that there were a few points that I failed to pick up.

Post a comment

Name (required)

Email (required)

Enter the code shown above:

Related Blog Posts