Siemens S7-1200 System Manual page 183

Hide thumbs Also See for S7-1200:
Table of Contents

Advertisement

Constructing an SCL expression
An SCL expression is a formula for calculating a value. The expression consists of operands
and operators (such as *, /, + or -). The operands can be tags, constants, or expressions.
The evaluation of the expression occurs in a certain order, which is defined by the following
factors:
● Every operator has a pre-defined priority, with the highest-priority operation performed
● For operators with equal priority, the operators are processed in a left-to-right sequence.
● You use parentheses to designate a series of operators to be evaluated together.
The result of an expression can be used either for assigning a value to a tag used by your
program, as a condition to be used by a control statement, or as parameters for another SCL
instruction or for calling a code block.
Table 6- 2
Operators in SCL
Type
Parentheses
Math
Comparison
Bit logic
Assignment
As a high-level programming language, SCL uses standard statements for basic tasks:
● Assignment statement: :=
● Mathematical functions: +, -, *, and /
● Addressing of global variables (tags): "<tag name>" (Tag name or data block name
● Addressing of local variables: #<variable name> (Variable name preceded by "#" symbol)
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
first.
Operation
Expression
(
)
Power
Sign (unary plus)
Sign (unary minus)
Multiplication
Division
Modulo
Addition
Subtraction
Less than
Less than or equal to
Greater than
Greater than or equal to
Equal to
Not equal to
Negation (unary)
AND logic operation
Exclusive OR logic operation
OR logic operation
Assignment
enclosed in double quotes)
Programming concepts
6.5 Programming language
Operator
( , )
**
+
-
*
/
MOD
+
-
<
<=
>
>=
=
<>
NOT
AND or &
XOR
OR
:=
Priority
1
2
3
3
4
4
4
5
5
6
6
6
6
7
7
3
8
9
10
11
183

Advertisement

Table of Contents
loading

Table of Contents