Page review information
Edition covered
IEC 61131-3 (PLC programming languages) — IEC 61131-3:2013 (3rd ed.) — verify against your platform's conformance
Content status
Reviewed
Coverage
POU model, variable scope, and the task/scan execution model at concept level; scheduling guarantees and scope keywords are vendor-specific and deferred to platform docs.
Last reviewed
August 2026
Primary reference
The official published standard — required for final decisions

Confirm the governing edition, jurisdiction, and project-specific requirements before applying anything on this page.

Scope. This page teaches the IEC 61131-3 structuring model and the design habits around it. Scope keyword names, task scheduling, and watchdog behaviour are platform-specific — consult your platform’s documentation for the actual guarantees. Language choice is covered separately in Languages overview.

The POU model

IEC 61131-3 organises logic into Program Organization Units (POUs). There are three kinds, distinguished mainly by whether they carry memory between executions.

flowchart TD
    T[Task<br/>cyclic / event, priority] --> P[Program<br/>one machine section]
    P --> FB1[FB instance: Conveyor1<br/>private memory]
    P --> FB2[FB instance: Conveyor2<br/>private memory]
    FB1 --> F[Function: scale_raw<br/>stateless helper]
    FB2 --> F
    FB1 -.type.-> DEF[FB type: MotorStarter<br/>defined once]
    FB2 -.type.-> DEF

The type/instance distinction is the crux of reuse: define an FB once (MotorStarter), instantiate it many times (Conveyor1, Conveyor2), fix a bug in the type, and every instance inherits the fix. Copy-pasted logic gives you none of that — it multiplies every future bug fix by the number of copies.

Variable scope

Every variable is declared in a scope. The common scopes (keyword names vary by platform):

Globals are a maintenance trap. A global can be written from anywhere, so when its value is wrong you have no bounded list of suspects — the whole program is in scope. Globals also defeat reuse (an FB that reaches out to a global is no longer self-contained) and they hide data flow. Prefer passing data through inputs and outputs, so a POU’s dependencies are visible at its interface. Reserve globals for genuinely system-wide state — a plant-wide E-stop status, say — and keep that list short and documented.

Tasks and execution

A task decides when and how often a program runs. The standard’s model provides:

Underneath sits the scan cycle: read inputs → execute logic → update outputs, repeated. Scan time is the loop period, and the logic must comfortably finish within its task interval or the task overruns.

Standard model vs vendor reality. The task and priority concepts are defined by IEC 61131-3, but how many tasks you get, their scheduling, watchdog behaviour, and exactly when I/O is updated are platform-specific — Rockwell’s continuous/periodic/event tasks, Siemens organisation blocks (OBs), CODESYS tasks, and TwinCAT tasks all differ. Consult your platform’s documentation for the scheduling guarantees; never assume one vendor’s timing model on another.

Modular, reusable design

Naming conventions and the tag database

Consistent naming is what makes a large program navigable. IEC 61131-3 constrains identifiers — letters, digits, and underscores; no leading digit; no spaces or reserved words (details vary by platform). On top of that, adopt a project convention: area and function prefixes, instance names that match the P&ID or electrical tag, and a documented pattern for I/O.

The tag database is the single source of truth for symbolic names, data types, and I/O addresses. Keeping it clean — no duplicate tags, no address conflicts, valid identifiers — pays back at every modification. The Python engineering toolkit helps here: cst io-check validates I/O lists for duplicate tags and address conflicts, and cst tags-from-io generates a tag database under IEC 61131-3 identifier rules.

Structuring for maintainability and commissioning

Trust Boundary — Engineering Judgment Required

This site is an independent educational reference for industrial automation standards. It paraphrases and organizes guidance in original language; it is not a substitute for the official published standards, professional engineering judgment, or legal review, and content has not been independently verified against current published editions.

Items marked Review pending await technical review against the identified edition. Items marked Planned have no reviewed source material behind them. Do not rely on this site for compliance determinations, safety-critical design decisions, or legal interpretation.