Structured Text (ST)
Structured text is a high-level textual programming language defined in IEC 61131-3, with a syntax resembling Pascal, used in PLCs for calculations, data handling, loops and algorithms that are awkward to express graphically.
ST programs consist of assignments and IF, CASE, FOR, WHILE and REPEAT statements operating on typed variables, arrays and structures. Expressions use familiar arithmetic, comparison and Boolean operators, and code can call standard and user-defined functions and function blocks. Its Pascal-like syntax makes it approachable for engineers with a software background.
Structured text is used for recipe management, unit conversion, string processing, communication handling, state machines and mathematical routines such as filters or custom control algorithms. Many teams write reusable function blocks in ST and call them from ladder or FBD programs, combining compact code with graphical readability for maintenance staff.
Because ST runs within the same task scheduling as the other IEC 61131-3 languages, it is subject to the same timing constraints: long or unbounded loops can exceed the cycle time and trigger a watchdog fault. Online monitoring of textual code is less visual than ladder power flow, so clear naming, comments and version control matter. The third edition of IEC 61131-3 added object-oriented features such as classes, methods and interfaces, which vendors implement to different degrees.
Key points
- Textual IEC 61131-3 language with Pascal-like syntax
- Supports IF, CASE, FOR, WHILE and REPEAT statements
- Suited to maths, data handling, strings and complex algorithms
- Long or unbounded loops can exceed the scan watchdog time
- Often used to write reusable function blocks called from LD or FBD
Where AiVibe comes in
AiVibe designs and manufactures the AiAmbA AI Factory, whose edge devices and AI agents let people talk to PLC, CNC and robot controllers in plain language. Agents only propose changes, a trained operator confirms each one, and the AI Factory never replaces a machine's control or safety systems.
Related terms
- IEC 61131-3PLC & Industrial Control
- Ladder Logic (Ladder Diagram, LD)PLC & Industrial Control
- Function Block Diagram (FBD)PLC & Industrial Control
- PLC Scan CyclePLC & Industrial Control
- Programmable Logic Controller (PLC)PLC & Industrial Control