📄️ What is Structured Text?
Structured Text (ST) is a high-level, text-based programming language used to program PLCs (Programmable Logic Controllers).
📄️ Basic ST Syntax
In Structured Text (ST), each line of logic is written as a statement. Statements define what the PLC should do — such as setting values, evaluating conditions, or calling functions — and must follow a consistent format.
📄️ Variables and Assignment
Variable Naming
📄️ Basic Data Types
BOOL Type
📄️ Arithmetic and Comparison Operators
Arithmetic Operators
📄️ IF...THEN...ELSE Statements
The IF statement is the primary way to implement conditional logic in Structured Text. It allows the program to make decisions based on conditions that evaluate to TRUE or FALSE.
📄️ Logical Operators
Logical (Boolean) operators are used to combine or invert conditions that evaluate to TRUE or FALSE. They’re essential for writing expressive, multi-condition IF statements.
📄️ Comments and Documentation
Comments are an essential part of writing maintainable, readable, and collaborative PLC programs. While Structured Text is readable compared to graphical languages, clear comments help explain why something is done — not just what is happening.
📄️ CASE Statements
CASE checks one numeric expression and runs the statements that match the first selector. It keeps branching tidy compared to a long IF...ELSIF chain.
📄️ Loop Statements
FOR…DO…END_FOR;
📄️ Simple Examples and Patterns
This section provides simple, reusable logic patterns for common PLC programming tasks in Structured Text (ST).