Structured Text Language Specifications; Overview Of The Structured Text Language - Omron WS02-CXPC1-V9 - V9 Operation Manual

Table of Contents

Advertisement

Structured Text Language Specifications

5-1

Structured Text Language Specifications

5-1-1

Overview of the Structured Text Language

ST Language
Configuration
Statement (e.g., CASE):
Configured using variables,
equations, etc.
Note
136
Structured text is a high-level textual language that has selection and iteration
structures, and is similar to PASCAL.
■ 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
Variable Constant
CASE COLOR OF
1: NofRed := NofRed + 1;
2: NofBlue := NofBlue+1;
ELSE NofOther := NofOther+1;
END CASE;
IF NofRed > 100 OR NofBlue >100 THEN
STOP:=TRUE
END IF;
Statement (e.g., IF):
Configured using variables,
equations, etc.
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).
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*)
Comment:
A comment can be attached to a statement.
Configured using (* before the
comment and *) after the comment.
Section 5-1

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac cx-programmer 9Sysmac ws02-cxpc1-v9

Table of Contents