![Omron CS1-H Series Operation Manual Download Page 157](http://html1.mh-extra.com/html/omron/cs1-h-series/cs1-h-series_operation-manual_742526157.webp)
142
Structured Text (ST Language) Specifications
Appendix B
Operators
Note
Operations are performed according to the data type.
Therefore, the addition result for INT data, for example, must be a variable using the INT data type. Par-
ticularly care is required when a carry or borrow occurs in an operation for integer type variables. For
example, using integer type variables A=3 and B= 2, if the operation (A/B)*2 is performed, the result of
A/B is 1 (1.5 with the value below the decimal discarded), so (A/B)*2 = 2.
Functions
EXIT
Stops repeated processing.
EXIT;
RETURN
Returns to the point in the program
from which a function block was called.
RETURN;
Operation
Symbol
Data types supported by operator
Priority
1: Lowest
11: Highest
Parentheses and
brackets
(
expression
),
array
[
index
]
1
Function evaluation
identifier
Depends on the function (refer to
2-6 Instruction
Support and Operand Restrictions
)
2
Exponential
**
REAL, LREAL
3
Complement
NOT
BOOL, WORD, DWORD, LWORD
4
Multiplication
*
INT, DINT, UINT, UDINT, ULINT, REAL, LREAL
5
Division
/
INT, DINT, LINT, UINT, UDINT, ULINT, REAL, LREAL 5
Addition
+
INT, DINT, LINT, UINT, UDINT, ULINT, REAL, LREAL 6
Subtraction
−
INT, DINT, LINT, UINT, UDINT, ULINT, REAL, LREAL 6
Comparisons
<, >, <=, >=
BOOL, INT, DINT, LINT, UINT, UDINT, ULINT,
WORD, DWORD, LWORD, REAL, LREAL
7
Equality
=
BOOL, INT, DINT, LINT, UINT, UDINT, ULINT,
WORD, DWORD, LWORD, REAL, LREAL
8
Non-equality
<>
BOOL, INT, DINT, LINT, UINT, UDINT, ULINT,
WORD, DWORD, LWORD, REAL, LREAL
8
Boolean AND
&
BOOL, WORD, DWORD, LWORD
9
Boolean AND
AND
BOOL, WORD, DWORD, LWORD
9
Boolean exclusive
OR
XOR
BOOL, WORD, DWORD, LWORD
10
Boolean OR
OR
BOOL, WORD, DWORD, LWORD
11
Function
Syntax
Numerical Functions
Absolute values, trigonometric functions, etc.
Arithmetic Functions
Exponential (EXPT)
Data type conversion Functions
Source data type
_TO_
New data type
(
Variable
name
)
Statement
Function
Example
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...