Automation Glossary • Structured Text

What Is Structured Text?

Merobix Engineering • • 4 min read

Structured text, or ST, is the high-level, text-based PLC programming language defined by IEC 61131-3. If ladder logic looks like an electrical diagram, structured text looks like traditional software - with variables, IF statements, loops, and math. It is the language controls engineers reach for when logic gets too complex or too calculation-heavy to express cleanly in rungs or blocks.

Back to Blog

Structured Text in one line: Structured text (ST) is a high-level, Pascal-like PLC programming language defined in IEC 61131-3, using constructs such as IF/THEN, FOR loops, and arithmetic expressions to implement complex logic and calculations that would be cumbersome in ladder logic.

How Structured Text Works

Structured text uses familiar programming constructs: assignment (:=), conditionals (IF/ELSIF/ELSE), loops (FOR, WHILE, REPEAT), CASE statements, and arithmetic and logical operators. Variables are declared with defined data types, and the code executes top to bottom each scan. To anyone who has written Pascal, C, or Python, it reads immediately - though it still runs inside the PLC's deterministic scan cycle like any other IEC 61131-3 language.

This textual form makes ST compact and expressive. A calculation that would need dozens of ladder rungs - iterating over an array, computing a totalized volume, or running a complex state machine - can be a few clear lines of structured text. It is also easy to comment, version, and review, which appeals to teams applying software-engineering discipline to control code.

When to Use Structured Text

ST is the right tool for math-intensive and algorithmic logic: flow calculations, unit conversions, data manipulation, recipe handling, and complex conditional logic. It is far more readable than ladder for anything involving loops or arrays. Many engineers use it selectively - writing the bulk of a program in ladder or FBD for readability, and dropping into ST for the parts that genuinely need it.

The trade-off is audience. Ladder was designed so electricians and technicians could read it at 2 a.m.; structured text assumes some programming fluency, which not every field team has. In oil and gas, ST often appears in flow computers and metering logic, where the calculations are inherently mathematical. As with any language, the PLC publishes its results as tags, and a SCADA platform like Merobix reads and trends those tags over the controller's native protocol regardless of how the logic was written.

Frequently Asked Questions

What is the difference between structured text and ladder logic?

Ladder logic is graphical and relay-style, ideal for discrete interlocks and easy for technicians to read; structured text is a high-level text language suited to complex calculations, loops, and algorithms. Both are IEC 61131-3 languages and can coexist in one program.

Is structured text hard to learn?

If you have programmed in any language like Pascal, C, or Python, structured text is quick to pick up because it shares the same constructs. For teams with only electrical or ladder backgrounds, there is a steeper learning curve, which is why many projects use it only where its power is needed.

When should I use structured text over ladder?

Use structured text for math-heavy or algorithmic tasks - flow totalization, unit conversions, array processing, complex state machines - where ladder would become sprawling and hard to follow. Ladder remains a better fit for simple discrete interlocks and permissives.

From Definitions to a Live Dashboard

Merobix reads your field devices into a cloud SCADA - the real thing behind these terms, live in days from any browser.

Request a Free Demo +1 (903) 307-7300
More in Automation Glossary
Sequential Function Chart  •  MES  •  MOM  •  OEE  •  Instruction List  •  Motor Control Center (MCC)  •  All Automation Glossary →
Free SCADA operator training
Merobix University - 70 video lessons & 261 quiz questions, from first login to compliance reporting. No demo call required.
Start free →