Omron cx-programmer 5.0-function block operation 사용자 설명서

다운로드
페이지 183
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 := 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., 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.