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'
(#Alpha <> 12) AND NOT #Beta
5 + #Alpha
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
%MB100
Symbolic addressing
"PLC_Tag_1"
"Data_block_1".Tag_1
"Data_block_1".MyArray[#i]
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.
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
Relational expression
Comparison and logical expression
Arithmetic expression
Precede absolute addresses with the "%" symbol.
Without the "%", STEP 7 generates an undefined
tag error at compile time.
Tag in PLC tag table
Tag in a data block
Array element in a data block array
Programming concepts
6.5 Programming language
185