Structured Text (ST)

Structured text is a text based language that more closely resembles traditional computer programming languages. The syntax can be described as a stripped-down version of C++. This makes it more familiar for those with a background in software engineering who may not have experience with PLCs specifically. This language is powerful for use in complex applications.

Considerations for using ST:

  • Standard high level statements for programming: IF, CASE, FOR, WHILE, REPEAT

  • Easy Editing: the text based format allows easy copy/paste and sharing of code. Large pieces of text can be manipulated in a word processor or spreadsheet, and then pasted back into the program. Examples found online, or even from different PLC brand platforms, can easily be copied and used in a program.

  • Compact Form: Since there are no graphics, the information contained in each line of code is very dense and compact. This allows the programmer to view complex code all on one screen without scrolling back and forth. For example, 3 or 4 lines of ladder code with functions and multiple branches may take up the entire computer screen. This can be represented in structured text as only 2 lines of code.

  • Ongoing Maintenance: Once a PLC project is commissioned, the ongoing troubleshooting and maintenance of a structured text program may not be as easily handled by the end user. Many electricians are familiar with electrical schematics and can therefore understand the flow of a ladder logic program. If electricians do not have software coding familiarity, understanding ST would be difficult. This could be seen as an advantage or a disadvantage depending on the goal. One strategy is to keep complex code that should only be changed by subject matter experts kept in structured text, while portions of the program that need to be adjusted are offered in ladder.

Basic Syntax Rules:

The syntax of Structured Text follows some basic rules.

  • All statements end with a semicolon.

  • A routine closes with an End_If statement.

  • Spaces are not required, but can be used as a good practice for readability.

  • Not case sensitive, but lower/upper case can be used as good practice for readability.

 

 

 

 

LP001-2