IEC 61131-3 is the international standard for PLC programming. It defines the programming languages, data types and software structure used by programmable controllers. The current version is Edition 4, published on 22 May 2025. It covers Ladder Diagram (LD), Function Block Diagram (FBD) and Structured Text (ST), with Sequential Function Chart (SFC) for structuring sequences. Instruction List (IL) was removed in this edition.
| Language | Type | Best for | Status in Edition 4 |
|---|---|---|---|
| Ladder Diagram (LD) | Graphical | Discrete logic and easy fault-finding | Included |
| Function Block Diagram (FBD) | Graphical | Process control and signal flow | Included |
| Structured Text (ST) | Textual | Math, data handling and algorithms | Included |
| Sequential Function Chart (SFC) | Structuring | Machine and batch sequences | Included |
| Instruction List (IL) | Textual | Legacy programs | Removed |
What Does IEC 61131-3 Cover?
IEC 61131 is a multi-part standard for programmable controllers, and Part 3 deals with programming. Its value is a common structure. An engineer who understands tasks, function blocks and typed variables can read a well-organized program on many platforms, even when the editor looks different. If you are new to the hardware, start with our guide to what a PLC is.
What changed in Edition 4
| Change | What it means for you |
|---|---|
| Instruction List removed | Plan to migrate legacy IL code over time |
| Octal literals removed | Check older code that uses them |
| Synchronization added | Mutex and semaphore concepts for concurrent execution |
| USTRING and UCHAR added | UTF-8 text is now supported by the standard |
The IEC 61131-3 Software Model
The standard organizes a control project into levels. Understanding them is the key to designing a program that remains readable as the machine grows.
| Element | What it is | Practical example |
|---|---|---|
| Configuration | The complete control software | The whole PLC project |
| Resource | A processing facility | A CPU |
| Task | Decides when code runs | Cyclic, interval or event-triggered |
| Program | Top-level code unit | Conveyor or filling station |
| Function block | Reusable code with memory | Motor, valve, timer or PID |
| Function | Reusable code without memory | Scaling or limit calculation |
Function vs function block
This is the most important design distinction. A function has no memory, so the same inputs always give the same output. A function block keeps its state between scans, and each instance has its own data. That is why one motor block can be reused for a hundred motors, each with its own timer and alarm state.
The IEC 61131-3 Languages Compared
| Language | Strengths | Weaknesses |
|---|---|---|
| LD | Familiar to electricians, easy to monitor online | Awkward for math and data |
| FBD | Clear signal flow, good for loops | Large diagrams can sprawl |
| ST | Compact, strong for calculations | Harder for some maintenance staff |
| SFC | Makes the sequence visible | Overkill for simple logic |
Most good projects mix languages: SFC for the machine sequence, LD or FBD for device logic and ST for calculations. Consider who will maintain the machine at 3 a.m. Readability often matters more than clever code.
How to Structure a PLC Program
- Define the machine and break it into units, such as infeed, process and outfeed.
- List the devices in each unit: motors, valves, sensors and drives.
- Build one function block per device type, then reuse it.
- Separate the layers: input mapping, device control, sequence, alarms and output mapping.
- Assign tasks by speed. Put fast control in a fast task and slow monitoring in a slower one.
- Use typed data structures instead of loose global variables.
- Write each output in one place only, so its behavior is easy to trace.
- Test blocks on their own before integrating them, using simulation where possible.
Worked example: a reusable motor block
This Structured Text block starts and stops a motor, latches faults and raises an alarm if the running feedback does not arrive within 3 seconds.
FUNCTION_BLOCK FB_Motor
VAR_INPUT
Start : BOOL; (* momentary start command *)
StopOK : BOOL; (* TRUE when no stop is requested *)
Fault : BOOL; (* overload or drive fault *)
Feedback : BOOL; (* contactor or drive running *)
Reset : BOOL;
END_VAR
VAR_OUTPUT
Run : BOOL;
Alarm : BOOL;
END_VAR
VAR
tFeedback : TON;
END_VAR
tFeedback(IN := Run AND NOT Feedback, PT := T#3S);
IF Fault OR tFeedback.Q THEN
Alarm := TRUE;
ELSIF Reset THEN
Alarm := FALSE;
END_IF;
Run := (Start OR Run) AND StopOK AND NOT Alarm;
END_FUNCTION_BLOCK
Each motor then becomes one instance of the same block, so a fix in the block applies to all of them.
PROGRAM Conveyor
VAR
M101 : FB_Motor;
M102 : FB_Motor;
END_VAR
M101(Start := Cmd_Start, StopOK := Line_OK, Fault := OL_101,
Feedback := Aux_101, Reset := Cmd_Reset);
M102(Start := M101.Run, StopOK := Line_OK, Fault := OL_102,
Feedback := Aux_102, Reset := Cmd_Reset);
KM_101 := M101.Run;
KM_102 := M102.Run;
END_PROGRAM
The same pattern works well for loops. A PID function block instance can be placed in a fixed-interval task, and our PID tuning guide explains how to set it up.
IEC 61131-3 Best Practices
| Practice | Why it helps |
|---|---|
| Use consistent naming | Makes signals easy to find and search |
| Avoid magic numbers | Named constants explain the intent |
| Limit global variables | Reduces hidden dependencies |
| Keep blocks small | Easier to test and reuse |
| Comment the reason | The code already shows what it does |
| Handle bad inputs | A failed sensor should lead to a safe, known state |
| Use version control | Shows what changed and when |
| Watch the scan time | Heavy code can delay fast tasks |
Larger systems also need clear boundaries between the controller and supervisory software. Our comparison of PLC, DCS and SCADA explains where each one fits.
Frequently Asked Questions
What is IEC 61131-3?
IEC 61131-3 is the international standard for programmable controller languages. It defines the programming languages, data types and software structure used by PLCs and similar controllers.
What are the IEC 61131-3 languages?
The current edition covers Ladder Diagram, Function Block Diagram and Structured Text, plus Sequential Function Chart for structuring sequences. Instruction List was removed in Edition 4.
What is the latest edition of IEC 61131-3?
Edition 4.0 was published on 22 May 2025 and replaces the 2013 edition.
Was Instruction List removed from IEC 61131-3?
Yes. It was deprecated in the third edition and removed in the fourth. Some vendors may continue to offer it, so existing programs do not suddenly stop working.
What is a POU in IEC 61131-3?
POU stands for Program Organization Unit. The three classic POUs are the function, the function block and the program.
What is the difference between a function and a function block?
A function has no memory, so the same inputs always give the same result. A function block keeps its internal state between executions, which is why timers and counters are function blocks.
Which IEC 61131-3 language is best?
It depends on the job. Ladder suits discrete logic and maintenance, FBD suits process control, ST suits calculations and data handling, and SFC suits sequences. Many projects combine them.
Are PLC programs portable between IEC 61131-3 brands?
Only partly. Vendors implement different subsets and add their own extensions and libraries, so code usually needs some rework. PLCopen XML can help exchange projects between tools that support it.
Sources and Further Reading
- IEC 61131-3:2025: the official publication page.
- Stefan Henneken: Comparison of Edition 3 and Edition 4: detailed changes.
- OPC Foundation and PLCopen: Introduction to IEC 61131-3: the software model.
- PLCopen: IEC 61131-3, a Standard Programming Resource: languages and structure.
- Control Design: The Roles of SFC and FBD: using the languages together.
- PLCcode: IEC 61131-3 Editions Explained: edition history.
