EasyManua.ls Logo

Siemens S7-1200 - Page 183

Siemens S7-1200
1028 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Programming concepts
6.5 Programming language
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
183
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
first.
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
Operation
Operator
Priority
Parentheses
(
Expression
)
( , )
1
Math
Power
**
2
Sign (unary plus)
+
3
Sign (unary minus)
-
3
Multiplication
*
4
Division
/
4
Modulo
MOD
4
Addition
+
5
Subtraction
-
5
Comparison
Less than
<
6
Less than or equal to
<=
6
Greater than
>
6
Greater than or equal to
>=
6
Equal to
=
7
Not equal to
<>
7
Bit logic
Negation (unary)
NOT
3
AND logic operation AND or & 8
Exclusive OR logic operation
XOR
9
OR logic operation OR 10
Assignment
Assignment
:=
11
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
enclosed in double quotes)
Addressing of local variables: #<variable name> (Variable name preceded by "#" symbol)

Table of Contents

Other manuals for Siemens S7-1200

Related product manuals