engineering

The 5 PLC Programming Languages of IEC 61131-3 Compared

LD, FBD, IL, ST and SFC: what IEC 61131-3 actually defines, how the Siemens names map onto it, and which language is right for which task.

David Prybisch
10 min read
The 5 PLC Programming Languages of IEC 61131-3 Compared

1.What IEC 61131-3 governs

IEC 61131-3 is the international standard for programming programmable logic controllers. It defines not only languages but also data types, block types (function, function block, program) and the execution model.

The practical benefit: programming to the standard produces code another programmer can read and understand on a different controller. That does not make it portable in the copy-paste sense – vendor dialects differ too much. But the concepts are the same, and in practice that is the more important part.

2.Standard names and Siemens names

This is where the most common confusion arises – including in technical articles. The standard defines five languages; Siemens uses its own names for the same languages:

IEC 61131-3Siemens (TIA Portal / STEP 7)Type
LD – Ladder DiagramKOP – Kontaktplangraphical
FBD – Function Block DiagramFUP – Funktionsplangraphical
IL – Instruction ListAWL – Anweisungslistetextual
ST – Structured TextSCL – Structured Control Languagetextual
SFC – Sequential Function ChartGRAPHgraphical (sequence structure)

One further subtlety: SFC is strictly speaking not a programming language but a structuring element. Inside the steps and transitions of an SFC, the code is again written in one of the other languages. In practice SFC is nevertheless counted as the fifth language, and the standard covers it in the same part.

3.The five languages compared

LanguageStrengthLimitTypical use
LD (KOP)Intuitive for anyone with an electrical background; current-path metaphorUnwieldy beyond roughly 50 networks; poor for calculationsInterlocks, simple enable logic, emergency stop chains
FBD (FUP)Data flow visible; readable for combinational logic and controlGets cluttered quickly in large programsControl loops, analogue processing, signal conditioning
IL (AWL)Very close to the machine, compactHard to read, barely maintainable; classified as deprecated in the 3rd editionLegacy plants; no longer recommended for new development
ST (SCL)Loops, conditions, calculations, library blocks; text-based versioningLess illustrative than LD for pure interlock logicAlgorithms, recipes, data processing, reusable blocks
SFC (GRAPH)Sequences become a visible state machine instead of hiding in memory bitsOverhead for simple logicStep sequences, batch processes, operating mode control

3.1.LD – Ladder Diagram

Ladder mirrors circuit diagram logic: contacts in series form an AND, in parallel an OR. For maintenance staff with an electrical background this is the language with the lowest barrier to entry – an invaluable advantage when someone without programming knowledge has to follow an interlock at night.

The limit shows up with scale and arithmetic. A network with twenty contacts and three parallel branches is wider on paper than the screen, and scaling an analogue value turns into a chain of blocks.

3.2.FBD – Function Block Diagram

FBD shows signals as blocks with inputs and outputs. Where LD emphasises the current path, FBD emphasises the data flow – a better fit for analogue processing, controllers and anything that transforms values rather than switching them.

3.3.IL – Instruction List

IL is the language closest to the machine, essentially an assembler for the PLC. In the third edition of IEC 61131-3 (2013), IL was classified as deprecated; it is no longer recommended for new projects.

It stays relevant for one reason: legacy plants. Anyone taking over an S5 or S7 Classic program regularly meets IL – often without symbols. Being able to read it is not nostalgia during migrations, it is craft.

3.4.ST – Structured Text

ST is the language for everything that becomes cumbersome graphically: loops, case distinctions, calculations, string handling, generic library blocks.

// Example: scale an analogue value with range checking
FUNCTION FC_ScaleAnalog : REAL
VAR_INPUT
  iRaw        : INT;    // raw value 0…27648
  rMin, rMax  : REAL;   // target range in engineering units
END_VAR

IF iRaw < 0 THEN
  FC_ScaleAnalog := rMin;          // wire break / underflow
ELSIF iRaw > 27648 THEN
  FC_ScaleAnalog := rMax;          // overflow
ELSE
  FC_ScaleAnalog := rMin + (rMax - rMin) * INT_TO_REAL(iRaw) / 27648.0;
END_IF;

The same functionality in LD would be a multi-rung chain of blocks whose intent only becomes clear on close inspection.

A second, often underrated advantage: ST is text. That makes it meaningfully versionable in Git, reviewable line by line, and searchable with ordinary tools. Graphical languages are stored in binary formats – a diff there shows "block changed" at best.

3.5.SFC – Sequential Function Chart

SFC represents sequences as steps and transitions. The big gain is visibility: the plant's current state can be read directly online instead of being reconstructed from a dozen memory bits.

For step sequences – batch processes, cleaning cycles, operating mode changes – that is the decisive advantage during troubleshooting. For a simple interlock it is overhead.

4.Which language for what: a decision guide

No single language is best at everything. In practice this split has proven itself:

TaskRecommendation
Interlocks, enables, emergency stop logicLD – has to be readable at night without a programmer
Analogue processing, control loopsFBD
Algorithms, calculations, recipesST
Reusable library blocksST – parameterisable and versionable
Step sequences, batch processesSFC
Understanding and migrating legacy codeBe able to read IL – not write it anew

5.Mixing is allowed – and sensible

A widespread misconception is that you have to commit to one language. The opposite is true. The standard explicitly provides for each block being written in the language that suits its task.

A typical project then looks like this:

OB1 (Main)                         → LD, calls only
  ├── FB_ModeControl               → SFC (operating modes as a step chain)
  ├── FB_ConveyorControl           → ST (logic + timing)
  │     └── FC_ScaleAnalog         → ST (calculation)
  ├── FC_SafetyInterlocks          → LD (must be readable without tools)
  └── FB_AlarmHandler              → ST (library block)

What matters is only that the choice is justified and stays consistent across the project. Five languages mixed at random are worse than one language applied consistently.

6.Conclusion

  • IEC 61131-3 defines five languages: LD, FBD, IL, ST and SFC. SCL is Siemens' name for ST, not a sixth language.
  • IL has been deprecated since 2013 – read it yes, write it new no.
  • ST carries most of a modern project, because it allows calculations, libraries and versioning.
  • LD stays for safety-relevant and maintenance-critical logic, because readability during a fault decides downtime.
  • Mixing languages is standard-compliant and sensible – as long as the choice is justified and consistent.

7.Further reading

Tags

SPS-ProgrammiersprachenIEC 61131-3SCLStructured TextKOPFUPAWLGRAPHSFCTIA PortalSPS-ProgrammierungLadder DiagramS7-1500Legacy-Migration

Questions about your automation project?

As an automation engineer based in Stadtbredimus, Luxembourg, I offer free initial consultations for companies in the Greater Region Saar-Lor-Lux.

David Prybisch · PLC · HMI · Commissioning

Related Articles

Frequently Asked Questions

Which 5 programming languages does IEC 61131-3 define?

LD (Ladder Diagram), FBD (Function Block Diagram), IL (Instruction List), ST (Structured Text) and SFC (Sequential Function Chart). At Siemens they are called KOP, FUP, AWL, SCL and GRAPH. SFC is strictly a structuring element but is commonly counted as the fifth language.

Is SCL the same as ST?

Yes. SCL (Structured Control Language) is Siemens' implementation of Structured Text per IEC 61131-3. Lists presenting SCL and ST as two separate languages count one language twice — usually at the expense of IL, which then goes missing. The standard defines five languages, not six.

Which PLC programming language should I learn?

Structured Text (SCL) first, because most of a modern project is written in it and calculations, library blocks and versioning are all solved cleanly there. Ladder second, because interlocks and safety-relevant logic live there and must stay readable during a fault without programming knowledge.

Is Instruction List still relevant?

Not for new development — the third edition of IEC 61131-3 from 2013 classified IL as deprecated. It stays relevant for legacy plants: anyone taking over or migrating an S5 or S7 Classic program meets it regularly, often without symbols. Being able to read it is essential; writing it anew is not.

When should I use ST instead of Ladder?

For anything involving calculations, loops, case distinctions or reusable blocks. Scaling an analogue value with range checking is ten readable lines in ST and a chain of blocks in Ladder whose intent only becomes clear on close inspection. Conversely, Ladder stays the better choice for interlocks.

Can several PLC languages be mixed in one project?

Yes, the standard explicitly provides for it: each block is written in the language that suits its task. Typically calls in Ladder, step sequences in SFC, logic and library blocks in ST, and safety interlocks in Ladder. What matters is that the choice is justified and stays consistent across the project.

Why is ST easier to version than Ladder?

Because ST is text. Text files can be compared line by line in Git, commented in code reviews and searched with ordinary tools. Graphical languages are stored in binary formats — a diff there shows at best that a block changed, not what changed.

What is the difference between SFC and a step chain in Ladder?

Functionally both can be implemented, but SFC makes the state visible: the active step can be read directly online. In Ladder the same state hides in memory bits and has to be reconstructed during troubleshooting. For batch processes and operating mode changes that is the decisive diagnostic advantage.