EasyManua.ls Logo

Siemens SIMATIC S7-1200 - 10 Motion control is easy

Siemens SIMATIC S7-1200
1614 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
7.5 Programming language
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
203
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 7- 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)
The following examples show different expressions for different uses:
"C" := #A+#B;
Assigns the sum of two local variables to a tag
"Data_block_1".Tag := #A;
Assignment to a data block tag
IF #A > #B THEN "C" := #A;
Condition for the IF-THEN statement
"C" := SQRT (SQR (#A) + SQR (#B));
Parameters for the SQRT instruction
Arithmetic operators can process various numeric data types. The data type of the result is
determined by the data type of the most-significant operands. For example, a multiplication
operation that uses an INT operand and a REAL operand yields a REAL value for the result.

Table of Contents

Other manuals for Siemens SIMATIC S7-1200

Related product manuals