Structured text

From Wikipedia, the free encyclopedia

Structured text is one of the 5 languages supported by the IEC 61131-3 standard. It is designed for programmable logic controllers (PLCs). It is a high level language that is block structured and resembles PASCAL. All of the languages share IEC61131 Common Elements. The variables and function calls are defined by the common elements so different languages can be used in the same program.

The file format has now been standardized to XML by PLCopen.

Complex statements and nested instructions are supported:

  • Iteration loops (REPEAT-UNTIL; WHILE-DO)
  • Conditional execution (IF-THEN-ELSE; CASE)
  • Functions (SQRT(), SIN())

[edit] Sample Program:

(* simple state machine *)
TxtState := STATES[StateMachine];
CASE StateMachine OF
   0: ;; (* FAIL *)
   1: ClosingValve();
ELSE
    ;; BadCase();
END_CASE;

[edit] External links

In other languages