50
6 ST LANGUAGE
6.1 Configuration
Delimiter
The following delimiters are provided in ST language for clarifying the program structure.
Operator
The following shows the operators used in a ST program and the target data types and operation result data types for each
operator.
The following table shows the priorities of the operators.
• If an expression includes multiple operators with the same priority, the operation is performed from the leftmost operator.
• Up to 1024 operators can be used in one statement.
Symbol Description
() Parenthesized
[] Specification of an array element
. (period) Specification of members of the structure or function block
, (comma) Separation of arguments
: (colon) Device type specifier
; (semicolon) End of a sentence
' (single quotation mark) Description of a character string
.. (two periods) Specification of an integer range
Operator Target data type Operation result type
*, /, +, - ANY_NUM ANY_NUM
<, >,<=, >=, =, <> ANY_ELEMENTARY Bit
MOD ANY_INT ANY_INT
AND, &, XOR, OR, NOT ANY_BIT ANY_BIT
** ANY_REAL (Base)
ANY_NUM (Exponent)
ANY_REAL
Operator Description Example Priority
( ) Parenthesized expression (2+3)*(4+5) 1
Function ( ) Argument of a function CONCAR('AB','CD') 2
** Exponentiation 3.0**4 3
- Inversion of sign -10 4
NOT Bit type complement NOT TRUE
* Multiplication 10 * 20 5
/ Division 20 / 10
MOD Modulus operation 17 MOD 10
+ Addition 1.4 + 2.5 6
- Subtraction 3 - 2
<, >, <=, => Comparison 10 > 20 7
= Equality T#26h = T#1d2h 8
<> Inequality 8#15 <> 13
&, AND Logical AND TRUE AND FALSE 9
XOR Exclusive OR TRUE XOR FALSE 10
OR Logical OR TRUE OR FALSE 11