EasyManua.ls Logo

Siemens S7-1200 - Page 185

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
185
Conditions
A condition is a comparison expression or a logical expression whose result is of type BOOL
(with the value of either TRUE or FALSE). The following example shows conditions of
various types.
#Temperature > 50
#Counter <= 100
#CHAR1 < 'S'
Relational expression
(#Alpha <> 12) AND NOT #Beta
Comparison and logical expression
5 + #Alpha
Arithmetic expression
A condition can use arithmetic expressions:
The condition of the expression is TRUE if the result is any value other than zero.
The condition of the expression is FALSE if the result equals zero.
Addressing
As with LAD and FBD, SCL allows you to use either tags (symbolic addressing) or absolute
addresses in your user program. SCL also allows you to use a variable as an array index.
Absolute addressing
%I0.0
Precede absolute addresses with the "%" symbol.
Without the "%", STEP
7 generates an undefined
tag error at compile time.
%MB100
Symbolic addressing
"PLC_Tag_1"
Tag in PLC tag table
"Data_block_1".Tag_1
Tag in a data block
"Data_block_1".MyArray[#i]
Array element in a data block array
Indexed addressing with PEEK and POKE instructions
SCL provides PEEK and POKE instructions that allow you to read from or write to data
blocks, I/O, or memory. You provide parameters for specific byte offsets or bit offsets for the
operation.
Note
To use the PEEK and POKE instructions with data blocks, you must use standard (not
optimized) data blocks. Also note that the PEEK and POKE instructions merely transfer data.
They have no knowledge of data types at the addresses.

Table of Contents

Other manuals for Siemens S7-1200

Related product manuals