Skip to content
Tutorials Center
My learning

Topics

Lesson 4 of 37 Β· Getting Started

IEC 61131-3 PLC Languages

Meet the five IEC 61131-3 PLC languages (LD, FBD, ST, IL, SFC), the program structure (POU, tasks, resources) and the major PLC brands and software.

PLC makers once each invented their own programming style, which made skills hard to move between brands. The international standard IEC 61131-3 defines a common set of languages, data types and program structure that most modern PLC software follows, at least in part. Learning it gives you a vocabulary that works on Siemens, Rockwell, Mitsubishi, Beckhoff, Schneider and CODESYS-based controllers.

This lesson introduces the five languages, how a program is organized, and the main brands, so you know what you will see in the rest of the course.

The five languages

Language Abbrev. Style Typical use
Ladder Diagram LD Graphical, like a relay schematic Discrete logic, interlocks
Function Block Diagram FBD Graphical blocks wired together Signal processing, control loops
Structured Text ST Text, Pascal-like Math, loops, algorithms, data handling
Instruction List IL Low-level text (assembly-like) Legacy; deprecated in the newest edition
Sequential Function Chart SFC Steps and transitions Machine sequences and batch processes

Graphical languages

Ladder (LD) Contacts and coils
FBD Blocks and wires
SFC Steps and transitions

Easy to read online

1 / 2

Real programs often mix languages: ladder for interlocks, Structured Text for calculations, SFC for the overall sequence.

One rule, three languages

The same logic written three ways makes the differences clear. The rule: the motor runs when Start is pressed and the guard is closed.

Structured Text (read-only):

TEXT
Motor := Start AND GuardClosed;

Function Block Diagram idea: an AND block with two inputs (Start, GuardClosed) whose output is wired to Motor.

Ladder idea: two normally-open contacts in series on a rung, ending at a coil Motor. Each language is the same program for the CPU; you pick the one that reads best for the task.

Program structure: POUs, tasks and resources

IEC 61131-3 calls any reusable piece of code a Program Organization Unit (POU). There are three kinds:

  • Program: the top-level code the CPU runs each cycle.
  • Function block (FB): code with its own memory (instances remember values between calls, like a timer). See function blocks.
  • Function (FC): code with no memory; the same inputs always give the same output.

A task says when a program runs (cyclic every 10 ms, or on an event). A resource is a CPU, and a configuration is the whole system. You rarely need the exact words, but they appear in every manual.

flowchart TD
    CFG["Configuration"] --> RES["Resource (CPU)"]
    RES --> T1["Task: Main, 20 ms"]
    RES --> T2["Task: Fast, 2 ms"]
    T1 --> P1["Program: Conveyor"]
    T2 --> P2["Program: Measurement"]
    P1 --> FB["Function blocks"]

Figure: how the standard organizes tasks and programs.

Data types and variables

IEC defines clear types: BOOL, INT, DINT, REAL, TIME, STRING and more. You will explore them in number systems and data types. Variables are declared with a scope: VAR (local), VAR_INPUT, VAR_OUTPUT, and VAR_GLOBAL.

TEXT
PROGRAM Conveyor
VAR
    Start       : BOOL;
    GuardClosed : BOOL;
    Motor       : BOOL;
END_VAR

Motor := Start AND GuardClosed;
END_PROGRAM

Brands and software

You will meet different software depending on the PLC.

Brand family Typical software
Siemens (S7-1200/1500) TIA Portal
Rockwell / Allen-Bradley Studio 5000 Logix Designer
Mitsubishi GX Works
Beckhoff TwinCAT
Schneider, many OEMs EcoStruxure, CODESYS
Omron Sysmac Studio

Names and exact features change across versions, and each vendor adds its own extensions to the standard (Rockwell calls variables tags, for example). The ideas in this course transfer between all of them.

A C stand-in: choosing logic by language

The following C stand-in evaluates one rule written in "series contacts" style and in "expression" style, to show they are equal for every input combination.

C Stand-in: the same rule written two ways (C model)

Press Run (or Ctrl + Enter) to see the result here.

Program input Β· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

Choosing a language

  • Use LD when technicians who are used to electrical drawings will read and debug it online.
  • Use ST for calculations, loops, arrays, string handling and anything that would be a sprawl of rungs.
  • Use FBD where signals flow through blocks, such as filters and control loops.
  • Use SFC to describe the steps of a process so that anyone can see "where the machine is".
C Stand-in: a tiny SFC-like step machine (C model)

Press Run (or Ctrl + Enter) to see the result here.

Program input Β· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

A chart of steps and transitions like this is exactly what SFC draws graphically; you will build one in Timers, Counters and Sequences.

Check your understanding

Quick check Β· 4 questions

of 4 answered You scored / 4 Β· perfect!

  1. 1. What is IEC 61131-3?

    It defines common languages, data types and program organization for PLCs.
  2. 2. Which language is best suited to heavy calculations and loops?

    Structured Text is a text language with IF, CASE and loops, ideal for math and data handling.
  3. 3. What distinguishes a function block from a function?

    Function blocks are instantiated and keep state (like timers); functions do not.
  4. 4. Which language shows steps and transitions of a process?

    Sequential Function Chart models a process as steps linked by transition conditions.

Summary

  • IEC 61131-3 defines five languages: LD, FBD, ST, IL and SFC.
  • Code is organized into programs, function blocks and functions, run by tasks.
  • Vendors add their own extensions and software, but the concepts carry over.
  • Mix languages freely: pick the one that reads best for each job.

Next: Number Systems and Data Types