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
Содержание CS1-H Series
Страница 3: ...iv...
Страница 5: ...vi...
Страница 7: ...viii TABLE OF CONTENTS...
Страница 15: ...xvi Application Precautions 4...
Страница 151: ...136 Procedures Section 3 2...
Страница 153: ...138 Data Types Appendix A...
Страница 177: ...162 External Variables Appendix C...
Страница 181: ...166 Revision History...