PLC Programming Languages: Ladder, FBD, SFC, ST and IL Compared

Share:
DCS and Automation
PLC Programming Languages Compared

IEC 61131-3 defines five standard PLC programming languages, each suited to a different type of problem.

Knowing when to use each PLC programming language is just as important as knowing how to write code.

This guide compares all five PLC programming languages with syntax examples, real code, application guidance, and a language selector tool.

Ladder Diagram Function Block Structured Text SFC

PLC programming languages are not interchangeable. Ladder Diagram reads like a relay schematic. Structured Text reads like high level code. Sequential Function Chart models a process sequence as a flowchart. Each has a home territory where it outperforms the others.

PLC Programming Languages Defined by IEC 61131-3

Welcome! In this article, we are going to explore all five PLC programming languages defined by the IEC 61131-3 standard. By understanding each PLC programming language, you will be able to choose the right one for every project.

If you have worked with PLCs before, you have probably used Ladder Diagram. But the standard actually gives us four more options, each designed for a different kind of thinking and a different kind of automation problem. By the end of this article, you will know exactly which language to reach for on your next project.

PLC programming language

IEC 61131-3 is the international standard that defines PLC programming. It specifies five PLC programming languages so engineers from different backgrounds can work with the same controller.

An electrical engineer reaches for Ladder Diagram because it looks like relay schematics. A software engineer prefers Structured Text because it resembles Pascal or C.

A process engineer uses Sequential Function Chart because it mirrors a process flow diagram. Click any term to expand.

Ladder Diagram (LD): A graphical language that represents the PLC program as rungs of a ladder. Left and right rails carry power. Contacts (inputs) and coils (outputs) sit on the rungs. It directly mirrors a relay logic circuit. Most widely used PLC programming language in discrete manufacturing and machine control.
Structured Text (ST): A high level text based language similar to Pascal. Supports variables, loops (FOR, WHILE), conditions (IF THEN ELSE), and function calls. Best for complex calculations, data processing, and algorithms that would require dozens of rungs in Ladder Diagram.
Sequential Function Chart (SFC): A graphical language that represents a process as a series of steps connected by transitions. Each step activates certain outputs. A transition condition moves the program to the next step. Models sequential processes (batch recipes, machine cycles) far more clearly than Ladder Diagram can.
5
PLC programming languages defined in IEC 61131-3
LD
Most widely used language in discrete manufacturing worldwide
ST
Fastest growing language, preferred for complex calculations and data handling
SFC
Best choice for sequential batch and machine cycle programming
Advertisement

All 5 PLC Programming Languages Explained in Detail

1. Ladder Diagram (LD)

Graphical IEC 61131-3 LD Best for: discrete I/O, relay replacement

Ladder Diagram represents the program as horizontal rungs between two vertical power rails.

Contacts on the left represent input conditions. A coil on the right represents the output action. If all contacts on a rung are true, the coil energises.

It maps directly to relay panel logic, which is why electricians adopt it quickly. Every PLC manufacturer supports it.

It is the default choice for simple machine logic, motor starters, and conveyor control. See the Ladder Logic for Beginners guide for a full introduction.

( Motor start/stop with seal-in contact ) |--[START]--+--[MOTOR_RUN]--+--( MOTOR_COIL )--| | | | |--[STOP /]-+ |

Use when: the team has an electrical background, the logic is mostly discrete on/off, and the program must be maintained by field electricians who are not software engineers.

Avoid when: the program needs complex arithmetic, loops, or data array processing. These require many rungs of Ladder that are hard to read and harder to debug.

2. Function Block Diagram (FBD)

Graphical IEC 61131-3 FBD Best for: PID loops, signal conditioning

Function Block Diagram represents the program as a network of interconnected blocks. Each block is a function: a PID controller, a timer, a comparator, a filter. Data flows from left to right through the connections between blocks.

FBD maps naturally to instrument loop thinking. A PID block has a setpoint input, a process variable input, and an output signal -- connect them the same way you would draw a loop diagram.

The DCS function block programming guide covers FBD in DCS systems where it is the dominant choice.

Use when: the program is primarily continuous control (PID, cascade, ratio control), the team comes from an instrumentation background, or the program is running in a DCS style environment.

Avoid when: the program has complex sequential logic. FBD is excellent for continuous loops but becomes a tangled mess of connections when used for step-by-step sequences.

3. Sequential Function Chart (SFC)

Graphical IEC 61131-3 SFC Best for: batch, machine cycles, recipes

Sequential Function Chart models a process as a series of rectangular steps joined by horizontal transition bars. The program sits in exactly one active step at a time. When the transition condition below the active step becomes true, the program moves to the next step.

SFC is the clearest way to represent a batch sequence or machine cycle. A filling machine: Step 1 open inlet valve, Step 2 wait for level, Step 3 close valve, Step 4 open discharge.

Each step has an action list and each transition has a condition expression. The sequence is visible without reading code. See the sequential circuits article.

Use when: the program is a sequence of distinct steps with clear entry and exit conditions: batch reactors, filling machines, CIP/SIP cycles, robot programs.

Avoid when: the control is purely continuous (use FBD) or purely parallel discrete logic (use LD). SFC is a sequencer, not a general purpose language.

4. Structured Text (ST)

Text based IEC 61131-3 ST Best for: complex calculations, data processing

Structured Text is a high level text language with IF THEN ELSE, CASE, FOR, WHILE, and REPEAT constructs. Variables, data types, and function calls work similarly to Pascal or modern C. It is the most expressive of the five PLC programming languages for algorithmic work.

(* Calculate flow rate from raw sensor count *) IF RawCount > 0 THEN FlowRate := (RawCount - Offset) * ScaleFactor; IF FlowRate < 0.0 THEN FlowRate := 0.0; (* clamp at zero *) END_IF ELSE FlowRate := 0.0; END_IF

Use when: the program needs mathematical formulas, array manipulation, string processing, or algorithm implementation. Also excellent for reusable function blocks where readability matters more than graphical representation.

Avoid when: the maintenance team is electricians with no programming background. ST code is not readable to someone who learned PLCs through relay logic. Combine ST with LD by writing complex calculations in ST function blocks called from a Ladder main program.

5. Instruction List (IL)

Text based IEC 61131-3 IL Legacy, being removed from IEC 61131-3

Instruction List is a low level assembly like language. Each line is one instruction operating on an accumulator register. It was included in the original IEC 61131-3 standard as a bridge for engineers coming from relay instruction sets and early PLC programming.

(* IL equivalent of simple AND logic *) LD Switch_A AND Switch_B ST Motor_Output

Important: the 2013 edition of IEC 61131-3 deprecated Instruction List. Most modern PLC platforms are removing IL support. For new projects, Structured Text performs the same role with far better readability. Do not start new programs in IL. Use another PLC programming language instead.

Advertisement

PLC Programming Language Selector

Which PLC Programming Language Is Right for Your Project?
Select your application type and team background -- get the right PLC programming language recommendation
-
-

PLC Programming Languages Comparison Table

LanguageTypeBest ApplicationStrengthsLimitations
Ladder (LD)GraphicalDiscrete machine logic, motor controlFamiliar to electricians, easy to trace, universal supportPoor for complex maths, loops, or sequential process
Function Block (FBD)GraphicalPID loops, signal processing, continuous controlMaps to instrument loop diagrams, reusable blocksMessy for sequential logic, many connections hard to read
Sequential FC (SFC)GraphicalBatch processes, machine cycles, recipesProcess sequence visible at a glance, models state clearlyNot general purpose, requires other languages for step actions
Structured Text (ST)TextComplex calculations, data arrays, algorithmsCompact, expressive, similar to high level languagesNot readable by electricians, no graphical representation
Instruction List (IL)TextLegacy systems onlyCompact, close to hardwareDeprecated in IEC 61131-3 2013. Use ST for new work.

Mixing Languages in One Project

IEC 61131-3 allows all five PLC programming languages in the same project. This is a deliberate design choice.

A typical process plant project uses several PLC programming languages together, one per program unit. The main program runs in SFC. Each step calls a Ladder Diagram subroutine for discrete I/O logic.

Continuous control loops run as FBD function blocks. Complex alarm calculations use Structured Text.

This approach lets each section use the PLC programming language that suits it best. The key rule is consistency within each module. Do not mix PLC programming languages inside the same rung or function block.

Most modern PLC platforms (Siemens TIA Portal, Rockwell Studio 5000, Beckhoff TwinCAT, Schneider Unity) allow multiple PLC programming languages in one project. Check your platform documentation for restrictions on mixing PLC programming languages within a single program unit (POU).

Application Matching Guide

Conveyor and Motor Control

Ladder Diagram. The start stop seal logic, safety interlocks, and running feedback all map directly to relay logic rungs. Every electrician on site can read and modify it. See the PLC counter instructions for counting conveyor cycles in LD.

PID Temperature Control

Function Block Diagram. Connect the temperature transmitter input to the PID block PV input, the setpoint from HMI, and the output to the heater control. The loop structure is visible on screen. See the PLC timer instructions for delay logic used in heater cycling.

Batch Reactor Sequence

Sequential Function Chart. Each phase of the batch (charge, heat, react, cool, discharge) becomes a step. Transition conditions are process values reaching target. The recipe is readable by both engineers and operators. See the sequential circuits article for the underlying state machine logic.

Flow Calculation and Totalling

Structured Text. Square root extraction, flow equation with correction factor, daily totaliser with reset -- these fit in 10 lines of ST but would need 40 or more rungs of LD.

Compile into a reusable function block called from the main program. See the shift register article for data queue patterns.

Watch: PLC Programming Languages Explained

Advertisement

PLC Programming Languages Questions

Which PLC programming language is used most in industry?
Ladder Diagram is the most widely used PLC programming language globally, especially in discrete manufacturing. Structured Text is growing rapidly in process and motion control applications.
Is Instruction List still used in new PLC projects?
IL was deprecated in IEC 61131-3 in 2013. This PLC programming language is being removed from most platforms. Use Structured Text for all new projects. IL is now only encountered in legacy system maintenance.
Can I use more than one PLC programming language in the same project?
Yes. IEC 61131-3 allows all five PLC programming languages in one project. Each program unit (POU) is written in one language; POUs call each other freely regardless of language.
What is the difference between FBD and SFC?
FBD is for continuous control -- data flows through blocks simultaneously. SFC is for sequential control -- the program moves step by step, with conditions triggering transitions. They solve different problems.
Which PLC programming language should a beginner learn first?
Ladder Diagram -- most universally supported, easiest without a programming background. Learn Structured Text next for calculations. See the Ladder Logic guide.

External References

Advertisement

What We Learn Today

  • IEC 61131-3 defines 5 PLC programming languages: LD, FBD, SFC, ST, and IL
  • Ladder Diagram suits discrete machine logic and teams with electrical backgrounds
  • Function Block Diagram suits continuous PID control and instrumentation engineers
  • Sequential Function Chart suits batch processes and machine cycles with distinct steps
  • Structured Text suits complex calculations, loops, and data processing tasks
  • Instruction List is deprecated -- use Structured Text for all new text based PLC programs
“The best PLC programming language is the one your maintenance team can read at two in the morning when the plant is down.”

Leave a Reply

Your email address will not be published. Required fields are marked *