Structured Text (ST) Programming in Schneider EcoStruxure Control Expert
Published on Aug 26, 2025 | Category: EcoStruxure Control Expert
Share this Page:
Structured Text (ST) is a high-level programming language used in industrial control systems and PLC programming. It allows engineers to write complex logic in a more readable and efficient way, making it easier to handle advanced automation tasks.
ST is standardized under the IEC 61131-3 standard, which ensures compatibility across different PLC platforms. By using Structured Text in Schneider EcoStruxure Control Expert, programmers can reduce complexity and improve flexibility in automation projects.In Structured Text, instructions are used to assign values returned from expressions to parameters. This structured approach helps in organizing logic, controlling processes, and creating reliable industrial automation applications.
What is Structured Text?
Structured Text (ST) is a high-level programming language used in PLC programming. It is part of the IEC 61131-3 standard and is similar to traditional programming languages such as Pascal or C. Structured Text is mainly used when complex calculations, data handling, or conditional logic is required, making it more flexible than Ladder Logic or Function Block Diagram.
Structured Text Example
In this example, the motor will turn ON only when the Start_Button is pressed and the Stop_Button is not pressed. Otherwise, the motor remains OFF.
Explanation of Elements
- Operands: These are the inputs, variables, or values used in the expression. For example, Start_Button, Stop_Button, and Motor are operands.
- Operators: These define the type of operation to be performed. In the example, = is the comparison operator, AND is the logical operator, and := is the assignment operator.
- Assignment: The := operator assigns the result of the expression to a variable. For example,
Motor := 1;
assigns the value 1 (ON) to the Motor variable.
Arithmetic Operators in Structured Text – Schneider EcoStruxure PLC
Arithmetic operators are used in Schneider EcoStruxure Control Expert PLC programming to perform mathematical calculations such as addition, subtraction, multiplication, and division. These operators help in handling numeric values in automation logic.
Result := A + B; (* Addition *)
Result := A - B; (* Subtraction *)
Result := A * B; (* Multiplication *)
Result := A / B; (* Division *)
Result := A MOD B; (* Modulus - remainder *)
Example: If A = 10 and B = 3, then:
- A + B = 13
- A - B = 7
- A * B = 30
- A / B = 3
- A MOD B = 1
Logical Operators in Structured Text – Schneider EcoStruxure PLC
Logical operators in Schneider EcoStruxure Control Expert are used to evaluate conditions and make decisions. They return a TRUE or FALSE result depending on the logic.
IF (Start_Button AND NOT Stop_Button) THEN
Motor := 1;
ELSE
Motor := 0;
END_IF;
- AND – Returns TRUE if both conditions are TRUE.
- OR – Returns TRUE if any one condition is TRUE.
- NOT – Reverses the logic of a condition.
Example: The motor will turn ON only if the Start button is pressed AND the Stop button is not pressed.
Assignment Operator in Structured Text – Schneider EcoStruxure PLC
The assignment operator (:=) in Schneider EcoStruxure Control Expert is used to assign a value or the result of an expression to a variable. It is one of the most commonly used operators in Structured Text programming.
Temperature := 75;
Motor := 1;
Result := A + B;
Example: Motor := 1;
assigns the value 1 (ON) to the variable Motor. Similarly, Result := A + B;
stores the sum of A and B into the variable Result.
How to Create a Structured Text (ST) Program in Schneider EcoStruxure Control Expert
Follow the steps below to create a new Structured Text program in EcoStruxure Control Expert:
- In the Project Tree, go to the Program section.
- Expand Tasks and select Mast (the main execution task).
- Inside Mast, open the Logic folder.
- Right-click on the Logic folder and select New Section.
- In the dialog box, choose ST – Structured Text as the programming language and click OK.
- A Structured Text editor will open where you can start writing your PLC program.
Schneider EcoStruxure Control Expert Structured Text Example
The following Structured Text (ST) program demonstrates the use of assignment operators, conditional statements, and arithmetic operators in Schneider EcoStruxure Control Expert.
Explanation of Structured Text Example – Schneider EcoStruxure Control Expert
- (* Condition to start/stop motor *) – This is a comment explaining the following block controls the motor based on button inputs.
- IF Start_Button = TRUE AND Stop_Button = FALSE THEN – Checks if the Start button is pressed and the Stop button is not pressed.
- Motor := TRUE; – Assigns the value TRUE to the variable Motor, turning the motor ON.
- ELSE – If the condition above is not met (either Start button is not pressed or Stop button is pressed), execute the following.
- Motor_A1 := FALSE; – Assigns FALSE to Motor_A1, ensuring the motor is OFF.
- END_IF; – Ends the IF-ELSE block for motor control.
- (* Arithmetic Operations *) – Comment indicating the next section performs calculations.
- Speed_Motor := 120; – Assigns 120 to the variable Speed_Motor.
- Load_belt := 45; – Assigns 45 to the variable Load_belt.
- Result := Speed + Load_belt; – Adds Speed (should be Speed_Motor) and Load_belt, stores sum in Result.
- Result := Result - 20; – Subtracts 20 from the current Result.
- Result := Result * 2; – Multiplies Result by 2.
- Result := Result / 5; – Divides Result by 5.
- Result := Result MOD 6; – Calculates the remainder of Result divided by 6 and stores it in Result.
- (* Conditional Logic with Arithmetic *) – Comment indicating the next IF block makes decisions based on the arithmetic result.
- IF Result > 10 THEN – Checks if Result is greater than 10.
- Motor_A1 := TRUE; – If Result > 10, sets Motor_A1 to TRUE (motor ON).
- ELSIF Result = 5 THEN – Else if Result equals 5, do the following.
- Motor_A1 := FALSE; – Sets Motor_A1 to FALSE (motor OFF).
- ELSE – If neither condition is true, do the following.
- Motor_A1 := Motor; – Keeps Motor_A1 in the same state as Motor (no change).
- END_IF; – Ends the IF-ELSIF-ELSE block for arithmetic-based motor control.
Build and Test Your Structured Text Program in Schneider EcoStruxure Control Expert
Follow these steps to test your ST program using the PLC simulator:
- Step 1: Build the Project
- After writing your Structured Text program, go to the top menu and select Build → Compile Project.
- This checks the program for syntax errors and prepares it for simulation.
- Step 2: Open the Simulator
- Go to PLC → Simulation Mode.
- Make sure the simulator is running and not connected to a physical PLC.
- Step 3: Connect the Project to the Simulator
- Transproject to PLC
- The project will be downloaded to the simulator memory.
- Step 4: Monitor and Test the Program
- Open the Watch Window or the Variable Table to monitor variable values in real-time.
- Simulate input signals like Start_Button and Stop_Button.
- Check if outputs such as Motor and Motor_A1 behave correctly according to the program logic.
- Step 5: Debug and Modify
- If the logic does not work as expected, stop the simulator, modify your ST code, rebuild, and download again.
- Repeat testing until the program runs correctly.
Tip: Always save your project before downloading to the simulator to prevent losing changes.