Structured Text (ST) is a high-level, text-based programming language used in PLC systems. It was formalized under the IEC 61131-3 international standard in 1993 to unify industrial automation programming practices. ST offers a syntax similar to traditional languages like Pascal or C, making it ideal for expressing complex logic, mathematical operations, and structured algorithms in a clean, readable format.
One of the key strengths of Structured Text is its flexibility and vendor-independence. Since many PLC manufacturers have adopted the IEC standard, programs written in ST are highly portable across different control platforms. This allows industries to change or upgrade their PLC hardware with minimal code rewriting, reducing long-term engineering costs and avoiding vendor lock-in.
As industrial processes become more advanced, ST is increasingly favored for applications that require looping, conditional logic, and data processing. Engineers prefer it for its speed of development, ease of troubleshooting, and the ability to write modular, scalable logic. Whether used alone or in combination with visual languages like Ladder Diagram (LD) or Function Block Diagram (FBD), Structured Text plays a crucial role in modern automation systems.
Structured Text (ST) is a high-level, textual programming language used to develop control logic in programmable logic controllers (PLCs). It is one of the five standardized languages defined under the IEC 61131-3 international standard, which was created to unify and modernize PLC programming practices across industrial platforms. Unlike graphical languages such as Ladder Diagram (LD) or Function Block Diagram (FBD), ST allows engineers to write logic using written statements, similar to traditional languages like Pascal, C, or Python.
Structured Text relies on a series of sequential commands and expressions that define the behavior of a control system. These include conditional statements (IF...THEN...ELSE), loops (FOR, WHILE), mathematical calculations, and function calls — making ST especially powerful for implementing complex algorithms, batch processes, or advanced data handling. Its clean, modular structure enables easier code maintenance, reusability, and faster debugging in large-scale automation projects.
ST is widely adopted in industries where flexible and scalable automation is essential. Its ability to integrate with other IEC languages and its platform independence make it a preferred choice for modern PLC programming. Whether used for motion control, process automation, or hybrid systems, Structured Text offers a robust, efficient, and future-ready solution for industrial control engineers.
Structured Text (ST) plays a critical role in PLC programming by enabling the development of complex, modular, and scalable control logic through a high-level, text-based syntax. It provides a more versatile approach compared to graphical programming languages, making it suitable for applications that require advanced computations, iterative processes, and conditional control structures.
ST is especially valuable in process automation, batch control, data handling, and situations where logic becomes too cumbersome to represent graphically. Its structure supports modern programming practices such as functions, function blocks, and reusable code modules, allowing engineers to maintain cleaner programs and reduce redundancy in large-scale industrial automation projects.
Furthermore, because ST is part of the IEC 61131-3 standard, it ensures platform independence and compatibility across various PLC manufacturers. This makes it easier for industries to migrate or scale control systems while preserving code integrity. As industrial control systems become more software-driven, Structured Text continues to play a key role in bridging traditional automation with modern programming capabilities.
Ladder Diagram (LAD) and Structured Text (ST) are both standardized PLC programming languages defined under the IEC 61131-3 standard, but they differ significantly in their representation and application.
Structured Text (ST) is a high-level, text-based programming language that uses structured control statements such as IF...THEN...ELSE, WHILE, and FOR loops to implement control logic. It resembles traditional programming languages like Pascal or C and is best suited for complex algorithms, data processing, and advanced automation logic. ST enables developers to create modular, scalable, and reusable code structures that are efficient and compact.
Ladder Diagram (LAD), on the other hand, is a graphical programming language that visually mimics electrical relay logic. It consists of vertical power rails and horizontal rungs, where each rung represents a logical expression or control function. LAD is intuitive for technicians and electricians, especially those with experience in relay-based systems. While easy to use and interpret, it is more limited when it comes to handling complex calculations or program structures.
In summary, Structured Text is more flexible and powerful but requires programming expertise, while Ladder Diagram is simpler and more visual, making it ideal for basic control tasks and quick troubleshooting.
Structured Text (ST) uses a syntax similar to high-level programming languages like Pascal or C. It follows structured programming principles and supports standard constructs such as variable declarations, conditional statements, loops, and function calls. Each ST program is typically organized into blocks such as PROGRAM, FUNCTION, or FUNCTION_BLOCK, and uses semicolons ; to terminate each statement.
Here are some of the most commonly used elements in ST syntax:
Example of Basic Structured Text Code:
PROGRAM MAIN VAR Counter : INT; Start : BOOL; END_VAR IF Start THEN FOR Counter := 1 TO 5 DO // Perform some action END_FOR; ELSE Counter := 0; END_IF; END_PROGRAM
In this example, the program checks whether the Start signal is TRUE. If so, it executes a FOR loop from 1 to 5. If not, it resets the Counter to 0. This structured approach makes ST ideal for implementing clear and maintainable logic in PLCs.
assignment operator(:=) used to assign a value to the tag. this is ":=" assignment operator. terminate assignment by semi colon ';'. below is the some example of assignment operator. In Structured Text (ST), an assignment statement is used to assign a value or the result of an expression to a variable (also called a tag). The assignment operator in ST is :=, which means “assign the value of the expression on the right-hand side to the variable on the left-hand side.” Every assignment must be terminated with a semicolon ;.
Syntax:
VariableName := Expression;
Examples:
// Assigning a constant value Temperature := 75; // Assigning the result of an arithmetic expression Speed := Distance / Time; // Assigning the result of a conditional logic Status := Motor1Running AND Motor2Running;
Assignments are fundamental to ST programming, as they define how values are updated during program execution. The assigned values can be constants, expressions, calculations, logical results, or the output of functions. Proper use of assignment improves clarity and accuracy in automation logic.
An expression in ST is any part of a statement that evaluates to a value. Expressions can be numeric, string-based, or boolean (true/false).
BOOL expression in structured text: a tag expression that have two value 1 for True or 0 for false. data type always bool. for example "temp ≤11".A bool expression uses bool tags, relational operators, and logical operators to compare values or check if conditions are true or false. Typically, use bool expressions to condition the execution of other logic
Numeric expression in structured text : An expression that store and calculates an numerical value. A numeric expression uses arithmetic operators, arithmetic functions, and bitwise operators.
String expression in structured text: An expression that store a string in memory area.
arithmetic operators in structured text this operator perform math operations of non boolean value.
Relational operators in structured text it perform comparison of two values or strings and provide a result in the form of true or false. The result of a relational operation is a BOOL value.
these operator used for perform verify if multiple conditions are true or false. The result of a logical operation is a BOOL value.
An instruction in Structured Text (ST) is a standalone statement that performs a specific operation. It may or may not have operands and always ends with a semicolon ;. Instructions use parentheses to enclose their operands.
Unlike functions, instructions cannot be used inside expressions. They are executed on their own and may return data or trigger actions such as communication, motion control, or I/O access.
// No operand instruction(); // Single operand instruction(tag1); // Multiple operands instruction(tag1, tag2, tag3);
Use instructions when the logic needs to be applied as a full statement — for example, data copying, triggering motion blocks, or enabling function blocks.