IEC 61131-3 & your practice PLC
One standard defines the languages almost every PLC uses. Meet them side by side, then build the Logivyx Soft-PLC trainer project you will use for every lab in this course: push buttons, switches and lamps on a screen, driven by your own logic.
By the end of this module you can
- Name the IEC 61131-3 languages and say when each one fits
- Read the same logic in ladder, function block diagram, Structured Text and instruction list
- Explain programs, function blocks and functions
- Set up a Logivyx Soft-PLC project with a trainer screen, a ladder routine and a Main routine
IEC 61131-3 (first published 1993, third edition 2013) standardises PLC programming languages and the building blocks around them. Here is one piece of logic, "run the motor while START or the seal-in is on and STOP is not pressed", in each language:
Graphical, modelled on relay circuits. Best for discrete on/off logic, interlocks and for maintenance staff who troubleshoot online.
Start_PB Stop_PB Motor
--| |----+----|/|-------------( )--
|
Motor |
--| |----+
Graphical blocks wired together like a circuit diagram. Popular for process control, analog signals and PID loops.
Start_PB ─┐
│ ≥1 ├──┐
Motor ────┘ │ & ├── Motor
Stop_PB ───────o──┘
A high-level text language similar to Pascal. Best for calculations, data handling, loops, strings and complex decisions.
Motor := (Start_PB OR Motor) AND NOT Stop_PB;
A low-level, assembler-like list. Deprecated in the third edition of the standard; you will still meet its relatives in Siemens STL and Mitsubishi instruction lists on older machines.
LD Start_PB OR Motor ANDN Stop_PB ST Motor
Not a language for single conditions but a way to structure a sequence: steps (what the machine is doing) and transitions (when to move on). Each step's actions are written in one of the other languages. Levels 4 and 7 cover it.
┌──────┐
║ Idle ║ (initial step)
└──┬───┘
┼ Start_PB AND Door_Closed
┌──┴───┐
│ Run │ N Motor
└──┬───┘
┼ Stop_PB
| Brand | Ladder | FBD | ST | IL-like | SFC |
|---|---|---|---|---|---|
| IEC / CODESYS | LD | FBD / CFC | ST | IL | SFC |
| Siemens TIA Portal | LAD | FBD | SCL | STL | GRAPH |
| Rockwell Studio 5000 | Ladder | FBD | ST | – | SFC |
| Mitsubishi GX Works3 | Ladder | FBD/LD | ST | (list view of ladder) | SFC |
| Logivyx | Ladder Designer | – | Logic Editor (ST) | – | Sequence Designer |
| POU | Has memory? | Example |
|---|---|---|
| Program | Yes | The machine's main logic, called by a task (Logivyx: a routine called from Main) |
| Function block (FB) | Yes, one copy per instance | A timer TON, a counter, your own Motor block. Each motor gets its own instance. |
| Function | No: same inputs always give the same result | SQRT, LIMIT, SCALE, your own Celsius_To_F |
The idea of an instance is important from module 07 onwards: a timer remembers how long it has been running, so every timer you use needs its own name (T_Delay, T_Horn…).
The labs run on the Logivyx Soft-PLC: the Logivyx logic engine acts as the controller, so you need no PLC hardware. What you will use:
Ladder Designer
Tools → Ladder Designer… Contacts (XIC, XIO, rising/falling edge), compare, branches, coils (OTE, OTL, OTU), timers (TON/TOF/TP), counters (CTU/CTD). Each ladder routine is translated into a Structured Text routine automatically.
Logic Editor
Tools → Logic Editor… Turns the engine on, sets the scan rate, and holds every routine. Main runs every scan and calls the others with CALL Name;.
Sequence Designer
Steps and transitions for machine sequences, generated as ST. Used from Level 4.
Screens
Push buttons, toggle switches and lamps on a screen stand in for real field devices. 🧮 Logic Diag shows the ladder live in Run mode.
Two habits that differ from a hardware PLC:
- Your "inputs" come from screen widgets in the labs. On a real machine they come from remote I/O through Data Exchange (Logivyx course, module 11).
- Every new routine must be called from Main, or it never runs.
This project is your trainer for the whole course. Later labs add one ladder routine each and call it from Main.
PLC_Trainer project
- Create the folder
D:\Projects\PLC_Trainer. In the Development Tool, File → New, pick your screen size, then File → Save As…D:\Projects\PLC_Trainer\PLC_Trainer.hmi. - Tools → Connect…, open the Soft-PLC tab and click Save Connection. The Soft-PLC is now the project's controller.
- In the Tag Browser click + Add Tag and create these BOOL tags, PLC Address blank:
PB1–PB4(push buttons),SW1–SW4(switches),Q1–Q6(outputs). Then two DINT tagsN1andN2. - On the first screen add four Push Buttons in Momentary mode, bound to
PB1–PB4, four Toggle Switches bound toSW1–SW4, six Indicators bound toQ1–Q6, and two Numeric Displays bound toN1andN2. Label each widget with its tag name. - Tools → Logic Editor…: tick Enable Logic Engine and set the scan rate to 50 ms. If there is no
Mainroutine, click + Add Routine, name itMainand tick Main routine (runs every scan). - Tools → Ladder Designer… → + Add Ladder Routine named
L04_Test. Click + Add Rung, drag a Contact — Normally Open onto it with tagSW1, and a Coil — Output Energize with tagQ1. Close the editor. - Open
Mainin the Logic Editor and add the lineCALL L04_Test;. Click Validate, then Save & Close. Save the project. - Press F5 for Run mode (Run mode connects the Soft-PLC by itself). Flip
SW1:Q1follows. Click 🧮 Logic Diag → View Ladder… and watch the rung energise. Esc returns to Edit mode.