Structured text
Encyclopedia
Structured text is one of the 5 languages supported by the IEC 61131-3
standard. It is designed for programmable logic controller
s (PLCs). It is a high level language that is block structured and syntactically 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.
Complex statements and nested instructions are supported:
TxtState := STATES[StateMachine];
CASE StateMachine OF
1: ClosingValve;
ELSE
;; BadCase;
END_CASE;
IEC 61131-3
IEC 61131-3 is the third part of the open international standard IEC 61131 for programmable logic controllers, and was first published in December 1993 by the IEC...
standard. It is designed for programmable logic controller
Programmable logic controller
A programmable logic controller or programmable controller is a digital computer used for automation of electromechanical processes, such as control of machinery on factory assembly lines, amusement rides, or light fixtures. PLCs are used in many industries and machines...
s (PLCs). It is a high level language that is block structured and syntactically resembles Pascal
Pascal (programming language)
Pascal is an influential imperative and procedural programming language, designed in 1968/9 and published in 1970 by Niklaus Wirth as a small and efficient language intended to encourage good programming practices using structured programming and data structuring.A derivative known as Object 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.
Complex statements and nested instructions are supported:
- Iteration loops (REPEAT-UNTIL; WHILE-DO)
- Conditional execution (IF-THEN-ELSE; CASE)
- Functions (SQRT, SIN)
Sample Program
(* simple state machine *)TxtState := STATES[StateMachine];
CASE StateMachine OF
1: ClosingValve;
ELSE
;; BadCase;
END_CASE;