# IEC 61131 — Programmable Logic Controllers

> IEC 61131 is the international standard for programmable logic controllers. Part 3 standardizes the 5 programming languages used in industrial automation (LD, FBD, SFC, ST, IL), enabling code portability between PLC platforms and a shared vocabulary for automation engineers worldwide.

- Source : https://industryhub.site/en/standards/iec-61131
- Body : IEC
- Family : Automation
- Status : current
- First published : 1993
- Latest revision : 2013 (Part 3 Edition 3)
- Edition : 3 (Part 3)
- Next revision : Active maintenance, Edition 4 in development for Part 3
- Access : Paid (IEC webstore — ~250 CHF per part)
- Language : English

## Document structure

- **IEC 61131-1** — General information : Definitions, scope, classification of PLCs.
- **IEC 61131-2** — Equipment requirements and tests : Hardware requirements : environment, EMC, mechanical, electrical safety.
- **IEC 61131-3** — Programming languages : THE famous part. Defines 5 programming languages (Ladder Diagram LD, Function Block Diagram FBD, Sequential Function Chart SFC, Structured Text ST, Instruction List IL — deprecated 2013). Plus data types, POUs (Program Organization Units), tasks.
- **IEC 61131-4** — User guidelines : Selection and application of PLCs (informative).
- **IEC 61131-5** — Communications : Cross-PLC messaging concepts (largely superseded by OPC UA in practice).
- **IEC 61131-6** — Functional safety : Safety-related aspects when using PLCs in safety applications (links to IEC 61508).
- **IEC 61131-7** — Fuzzy control programming : Niche : fuzzy logic standardization. Rarely used.
- **IEC 61131-8** — Guidelines for the application and implementation of programming languages : Best practices for IEC 61131-3 language usage.
- **IEC 61131-9** — Single-drop digital communication interface (IO-Link) : Standardizes IO-Link, the dominant smart sensor / actuator protocol in modern factories.
- **IEC 61131-10** — PLCopen XML format for programs : PLCopenXML : standard XML schema for storing IEC 61131-3 programs. Enables vendor-neutral program exchange.

## Key concepts

- **The 5 languages** : Ladder Diagram (LD) : looks like electrical relay schematics, intuitive for electricians. Function Block Diagram (FBD) : looks like circuit blocks wired together, intuitive for process engineers. Sequential Function Chart (SFC) : state machines / GRAFCET. Structured Text (ST) : looks like Pascal, intuitive for programmers. Instruction List (IL) : assembly-like, deprecated in 2013.
- **Program Organization Unit (POU)** : Reusable code unit. Three types : Program (top-level, has memory state), Function Block (instance-based, has memory state), Function (stateless, like a math function). Composability built into the language.
- **Standard data types** : BOOL, BYTE, WORD, DWORD, LWORD, SINT/INT/DINT/LINT, USINT/UINT/UDINT/ULINT, REAL, LREAL, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME, STRING. Derived types (ARRAY, STRUCT, enumerations, type aliases) for engineering structure.
- **Tasks and execution model** : Cyclic tasks (every N ms), event-driven tasks, freewheeling. Multi-tasking PLC with priority levels. Defined behavior under preemption.
- **PLCopen** : Industry association (vendors + integrators) that publishes practical guidelines and reference libraries on top of IEC 61131-3. Notable : PLCopen Motion Control (PLCopen MC) standardized FBs for servo control, used by every modern motion controller.
- **Variable scoping** : VAR / VAR_INPUT / VAR_OUTPUT / VAR_IN_OUT / VAR_GLOBAL / VAR_EXTERNAL. Strict typing, explicit declarations. Encourages disciplined code over the unstructured habits of early PLC programming.

## Why language standardization in PLCs took 20 years

Industrial automation in the 1970-80s was a Tower of Babel : every PLC vendor (Modicon, Allen-Bradley, Siemens, Mitsubishi, Omron, Telemecanique...) had their own programming language, their own development environment, their own concept of memory addressing. A trained Siemens engineer could not work on an Allen-Bradley PLC without months of retraining.

IEC 61131-3 (1993, major revision 2013) settled this. The 5 languages it defines are now supported by **every major PLC vendor** in some form. Engineers can move between platforms with vocabulary intact. Code patterns are portable in principle (in practice, vendor-specific extensions still create lock-in).

## Why 5 languages, not just one ?

Each addresses a different engineering tradition :

```
Electricians                      Process engineers              Programmers
                                                                            
        ╲                                ╱                              ╱
         ╲                              ╱                              ╱
          ╲                            ╱                              ╱
          [LD]   relay schematic   [FBD]   block diagram        [ST]   Pascal-like
                                                                            
                              Process engineers              
                                                                            
                                 [SFC]   state machine        
                                                                            
                              ↘ (IL was IL : assembly-like, deprecated 2013)
```

A modern industrial program typically MIXES :
- **ST** for math-heavy logic (PID computation, alarms, recipe management)
- **FBD** for control loop wiring (assembling PID + filter + scaler blocks)
- **LD** for safety-critical interlocks (auditors and electricians can read it without training)
- **SFC** for batch sequences and start-up procedures

This multilingual code is normal IEC 61131-3 practice, not a sign of confusion.

## What is portable in practice (and what isn't)

**Portable** : data types, basic algorithms, simple function blocks, standard motion FBs (PLCopen MC).

**Not portable** :
- I/O addressing (every vendor has its own scheme)
- Hardware configuration (PROFINET vs EtherCAT vs EthernetIP)
- HMI / SCADA integration (proprietary)
- Diagnostic features (extension blocks specific to vendor)
- Performance characteristics (cycle time guarantees)

This means **PLCopenXML import/export** (Part 10) gives you ~70% of an automation project ; the rest still needs vendor-specific configuration. For a fully vendor-neutral codebase, **CODESYS** is the practical leader — its runtime is licensed by ~50 PLC manufacturers (Beckhoff, WAGO, Lenze, ABB, etc.) and provides genuine cross-platform portability.

## Safety variant : IEC 61131-6 + IEC 61508

Standard PLCs are NOT safety-rated. For safety functions, you need a **safety PLC** (Pilz PNOZ, HIMA HIMax, Siemens S7-1500F, Allen-Bradley GuardLogix, Beckhoff TwinSAFE) that combines :
- IEC 61131-3 programming for the standard logic
- Dedicated **safety language** for safety logic (constraints, restricted set of FBs)
- IEC 61508 certified runtime (SIL 2 or SIL 3 capable)
- Hardware redundancy + diagnostic coverage internally

Modern safety PLCs are programmed in IEC 61131-3 with safety extensions, so the engineer's experience is unified. But the safety code is **separately certified** at the toolchain level (TÜV / exida certification of the IDE + runtime + hardware platform).

## The future : IEC 61131-3 vs object-oriented programming

Edition 3 (2013) added object-oriented features : METHODS on Function Blocks, INTERFACES, INHERITANCE. This brought PLC programming closer to modern software engineering practices, but adoption is uneven :
- **Beckhoff TwinCAT 3** : full OOP support, widely used
- **CODESYS** : full OOP support
- **Siemens TIA Portal** : partial OOP (improving each version)
- **Rockwell Studio 5000** : limited

For new projects, **using OOP carefully** (avoiding inheritance complexity but using methods + interfaces for testability) is now a recognized good practice. Older "all-global-state" PLC code is increasingly viewed as legacy.

## Applicable industries

Discrete manufacturing (automotive, electronics, packaging), Process industries with PLC-based control (often hybrid with DCS), Building automation, Energy management, Water and wastewater (frequent PLC-based), Machine building (every CNC, robot, packaging machine)

## References & further reading

- [IEC 61131 series — official](https://webstore.iec.ch/searchform&q=61131)
- [PLCopen — guidelines and motion control library](https://plcopen.org/)
- [Beckhoff TwinCAT 3 — full IEC 61131-3 implementation](https://www.beckhoff.com/twincat/)
- [CODESYS — multi-vendor IEC 61131-3 runtime](https://www.codesys.com/)
