![Omron SYSMAC CX-Programmer 9 Operation Manual Download Page 162](http://html1.mh-extra.com/html/omron/sysmac-cx-programmer-9/sysmac-cx-programmer-9_operation-manual_744241162.webp)
136
Structured Text Language Specifications
Section 5-1
5-1
Structured Text Language Specifications
5-1-1
Overview of the Structured Text Language
Structured text is a high-level textual language that has selection and iteration
structures, and is similar to PASCAL.
ST Language
Configuration
■
ST Language Configuration
An ST language program is composed from statements. There are two kinds
of statements: assignment and control.
• Assignment statement: This statement uses an equation to store a calcu-
lation result in a variable.
• Control statement: Includes statements such as selection statements and
iteration statements.
For details on each kind of statement, refer to
5-4 ST Language Configura-
tion
.
■
Statement Contents
Statements are composed of the following elements.
• Variables (Refer to
5-4-2 Variables
.)
• Constants (Refer to
5-4-3 Inputting Constants
.)
• Operators (Refer to
5-4-4 Operators
.)
• Functions (Refer to
5-4-5 Standard Functions
and
5-4-6 OMRON Expan-
sion Functions
.)
■
Example of a Control Statement
Note
In an ST program, addresses are not input as actual I/O memory addresses.
Variable names are used for all address inputs. The addresses that use vari-
ables are set by the user.
For details on variable specifications and setting methods, refer to the
CX-
Programmer Operation Manual
(W446).
CASE COLOR OF
1: NofRed := 1;
2: NofBlue := 1;
ELSE NofOther := N1;
END CASE;
IF NofRed > 100 OR NofBlue >100 THEN
STOP:=TRUE
END IF;
Statement (e.g., CASE):
Configured using variables,
equations, etc.
Equation: Configured using
operators and operands.
(*Variable COLOR value is...*)
(*1: Increment variable
NofRed
by 1*)
(*2: Increment variable
NofBlue
by 1*)
(*Neither 1 or 2: Increment variable
NofOther
by 1*)
(* When
NofRed
or
NofBlue
exceeds 100*)
(*Assign
TRUE
for variable
STOP
*)
Statement (e.g., IF):
Configured using variables,
equations, etc.
Comment:
A comment can be attached to a statement.
Configured using (* before the
comment and *) after the comment.
Variable Constant
Summary of Contents for SYSMAC CX-Programmer 9
Page 2: ......
Page 4: ...iv ...
Page 6: ...vi ...
Page 8: ......
Page 16: ...xvi ...
Page 20: ...xx ...
Page 26: ...xxvi Application Precautions 4 ...
Page 27: ...Part 1 Function Blocks ...
Page 28: ......
Page 154: ...128 Procedures Section 3 2 ...
Page 155: ...Part 2 Structured Text ST ...
Page 156: ......
Page 160: ...134 CX Programmer Specifications Section 4 2 ...
Page 206: ...180 Procedures Section 6 1 ...
Page 208: ...182 System defined external variables supported in function blocks Appendix A ...
Page 230: ...204 Revision History ...
Page 231: ......