IEC 61131-3 is the international standard that defines the programming languages and software model for programmable logic controllers (PLCs). First published in 1993 and revised in 2003 and 2013, it is the reason a controls engineer trained on one vendor's platform can read code written on another. Most major controller platforms — including CODESYS-based systems, Siemens TIA Portal, Rockwell Studio 5000, Beckhoff TwinCAT, Schneider EcoStruxure and B&R Automation Studio — implement it, though each with its own extensions and naming.
The standard defines two graphical languages, two textual languages, and one structuring language. Understanding what each one is designed for is the fastest way to write PLC code that other people can maintain.
The software model behind the languages
Before the languages themselves, IEC 61131-3 defines a common software model that all of them share:
- Program Organization Units (POUs) — the building blocks of every project. There are three kinds: functions (no memory between calls, same inputs always give the same output), function blocks (have internal state, instantiated like objects) and programs (the top-level units that tie everything together).
- Data types — elementary types such as
BOOL,INT,DINT,REAL,TIMEandSTRING, plus user-defined structures, enumerations and arrays. - Configurations, resources and tasks — how programs are mapped onto CPUs and scheduled, either cyclically or on events.
Because every language compiles to the same model, you can mix languages in one project. A function block written in Structured Text can be called from a Ladder rung, and an SFC step can run actions written in FBD.
Ladder Diagram (LD)
Ladder Diagram represents logic as relay contacts and coils arranged on rungs between two power rails. It descends directly from the relay panels that PLCs replaced in the late 1960s and 1970s.
Strengths
- Instantly readable by electricians and maintenance technicians.
- Excellent for discrete interlocks, permissives and simple sequencing.
- Online monitoring shows power flow visually, which makes troubleshooting fast.
Weaknesses
- Math, string handling, loops and data manipulation become awkward and verbose.
- Large programs turn into hundreds of rungs that are hard to structure.
Use it for: machine interlocks, motor starters, safety permissives and any logic that plant maintenance staff will need to troubleshoot at 3 a.m.
Function Block Diagram (FBD)
FBD connects function and function block instances with signal lines, much like a schematic or a process control diagram. Data flows from left to right.
Strengths
- Natural fit for continuous control: PID loops, signal conditioning, scaling and alarming.
- Familiar to process and instrumentation engineers, and close to the way many DCS platforms present control strategies.
- Reusable blocks encourage modular design.
Weaknesses
- Execution order can be non-obvious in complex diagrams.
- Large diagrams sprawl across many pages.
Use it for: analog control loops, signal processing chains and process control strategies.
Structured Text (ST)
Structured Text is a high-level textual language with a syntax derived from Pascal. It supports IF, CASE, FOR, WHILE and REPEAT statements, expressions and function calls.
IF TankLevel > HighLimit THEN
InletValve := FALSE;
HighLevelAlarm := TRUE;
ELSIF TankLevel < LowLimit THEN
InletValve := TRUE;
END_IF;
Strengths
- The most compact way to express math, algorithms, data handling and state machines.
- Works well with version control, diff tools and code review.
- Since the 2013 edition, supports object-oriented features such as methods, interfaces and inheritance for function blocks.
Weaknesses
- Harder for maintenance technicians to troubleshoot online than graphical languages.
- Easy to write clever code that nobody else can follow.
Use it for: calculations, recipe and data handling, communication parsing, complex state machines and reusable library blocks.
Sequential Function Chart (SFC)
SFC is not a language for writing logic so much as a way to structure it. It describes a process as a series of steps connected by transitions, with actions attached to steps. It is derived from the French GRAFCET standard (IEC 60848).
Strengths
- Makes sequential processes — batch phases, machine cycles, startup and shutdown sequences — explicit and visible.
- Online, you can see exactly which step is active and which transition is waiting.
- Supports parallel and alternative branches.
Weaknesses
- Overkill for simple logic.
- Error handling and abort paths need careful design or the chart becomes tangled.
Use it for: batch sequences, machine cycles and any process with clearly defined phases.
Instruction List (IL)
Instruction List is a low-level, assembler-like textual language. It was deprecated in the third edition of the standard (2013) and should not be used for new projects. You will still meet it when maintaining legacy code, so it is worth being able to read it.
How to choose: a practical rule set
| Task | Recommended language |
|---|---|
| Discrete interlocks and permissives | Ladder Diagram |
| Analog control loops and signal conditioning | Function Block Diagram |
| Math, data handling, algorithms, parsing | Structured Text |
| Batch phases and machine sequences | Sequential Function Chart |
| Reusable library function blocks | Structured Text (called from any language) |
Three principles matter more than the choice of language:
- Write for the person who will troubleshoot it. If the plant's maintenance team only reads Ladder, keep the logic they will touch in Ladder and hide complexity inside well-named function blocks.
- Be consistent. Agree on a language convention per module type in your company coding standard. PLCopen publishes coding guidelines that are a good starting point.
- Encapsulate. Use function blocks with clear interfaces instead of global variables. This matters more for maintainability than any language decision.
Portability: the limits of the standard
IEC 61131-3 makes skills portable, but code is only partly portable. Vendors differ in supported data types, system libraries, communication blocks, and how they store projects. The PLCopen XML exchange format helps move POUs between tools, but expect rework when migrating between platforms — especially for I/O configuration, motion and communication.