Skip to content

Structured Text Coming Soon

IEC 61131-3 is an international standard for programmable logic controllers (PLCs). It specifies the syntax, semantics, and display for a unified suite of programming languages for PLCs. IEC 61131-3 introduces several programming languages for industrial automation and control, among which Structured Text (ST) is one.

INFO

For more background about the IEC 61131-3 standard please read IEC 61131-3 Section

What is Structured Text?

Structured Text is a high-level programming language that uses a syntax similar to that of the Pascal programming language, which is also reminiscent of C and other procedural programming languages. It's designed for programming control logic in an easy-to-read text form.

Structured Text is particularly useful for implementing complex algorithms and mathematical functions that would be cumbersome to express with graphical programming languages like Ladder Diagram (LD) or Function Block Diagram (FBD), which are also specified in IEC 61131-3.

INFO

In contrast to Python, Structured Text is a compiled language and is very fast. Typical execution times in Industrial Automation applications range from 100μs to 5ms.

Key Features

  • High-level Constructs: It supports conditions, loops, functions, and function blocks, allowing for structured programming practices.
  • Data Types: ST supports a variety of data types including boolean, integer, real, string, arrays, and user-defined types, making it versatile for different needs.
  • Structured Control Flow: Offers constructs like IF...THEN...ELSE, CASE, FOR, WHILE, and REPEAT...UNTIL for controlling the execution flow.
  • Modularity and Reusability: Allows for the definition of functions and function blocks that can encapsulate functionality and be reused across different parts of the program or in different projects.
  • Mathematical and Logical Expressions: Facilitates complex mathematical calculations and logic operations, making it ideal for algorithmic processing in industrial applications.

Simple Example

Here's a simple example to demonstrate what ST might look like. This example checks if a temperature reading is above a certain threshold and sets an alarm state accordingly.

ST
VAR
    temperature : REAL; (* Declare a real number variable for temperature *)
    tempThreshold : REAL := 100.0; (* Declare and initialize the threshold *)
    alarmOn : BOOL; (* Declare a boolean variable for the alarm state *)
END_VAR

IF temperature > tempThreshold THEN
    alarmOn := TRUE; (* Set the alarm on if temperature exceeds the threshold *)
ELSE
    alarmOn := FALSE; (* Otherwise, keep the alarm off *)
END_IF;

Industrial Automation Use

Structured Text is widely used in industrial automation for tasks that require detailed control over the logic and operations, such as process control, complex machinery operations, and safety systems. Its textual nature makes it particularly well-suited for algorithms that involve calculations, data processing, and decision-making processes.

Being part of the IEC 61131-3 standard, Structured Text benefits from interoperability and standardization, meaning programs written in ST can be more easily understood and modified by engineers familiar with the standard, even when working across different brands and types of PLCs.

Launchpad Support

As the IEC 61131-3 Standard is not publicly available the functions supported by Launchpad are listed in ST Functions List.

Editor Supported Features

List of currently supported features below.

FeatureSupport
Code Folding
Syntax Highlighting
Auto-complete
Build & Deploy
Version Control
Spellcheck
Error Check
Linting
Debugging Tools