![Omron CS1-H Series Operation Manual Download Page 154](http://html1.mh-extra.com/html/omron/cs1-h-series/cs1-h-series_operation-manual_742526154.webp)
139
Appendix B
Structured Text (ST Language)
Specifications
Structured Text
Structured text (also referred to as ST language) is a high-level programming language similar to PASCAL that
uses language structures such as selection and iteration statements. Programs written using structured text
are configured using statements. Statements are configured from variables and equations.
• Equations are sequences containing operators and operands (variables or constants). Operators include
arithmetic operators, comparison operators, and logical operators.
• Statements are either assignment or control statements. Assignment statements store calculation results
from the equation in the variable. Control statements include selection statements and iteration state-
ments.
Example of Structured Text
Restrictions
Statement Delimiters
• Statements (assignment and control statements) must always end in a semicolon (;). The statement can-
not be completed by simply using a carriage return.
• Do not use a semicolon (;) as a delimiter within a statement such as following reserved words, values, or
equations. Inserting a semicolon within a statement, except at the end of a statement, will result in a syntax
error.
Comments
• Comments are enclosed in parentheses and asterisks, i.e., (*
comment
*). Any characters except parenthe-
ses and asterisks can be used within a comment. Nesting within comments is not supported.
Notation
Example
(*
comment
*)
(*this is the comment*)
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: Configured using (* before the
comment and *) after the comment.
Summary of Contents for CS1-H Series
Page 3: ...iv...
Page 5: ...vi...
Page 7: ...viii TABLE OF CONTENTS...
Page 15: ...xvi Application Precautions 4...
Page 151: ...136 Procedures Section 3 2...
Page 153: ...138 Data Types Appendix A...
Page 177: ...162 External Variables Appendix C...
Page 181: ...166 Revision History...