99BProgramming concepts
6.5 Programming language
S7-1200 Programmable controller
150
System Manual, 11/2011, A5E02486680-05
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 also provides PEEK and POKE instructions to allow you to read from or write to data
areas with variables that provide specific byte offsets or bit offsets for the operation.
PEEK(area:=_in_,
dbNumber:=_in_,
byteOffset:=_in_);
Reads the byte referenced by byteOffset of
the referenced data block, I/O or memory
area.
Example: MB100 := PEEK(area:=16#84,
dbNumber:=1, byteOffset:=#i);
PEEK_WORD(area:=_in_,
dbNumber:=_in_,
byteOffset:=_in_);
Reads the word referenced by byteOffset of
the referenced data block, I/O or memory
area.
Example: MW200 := PEEK(area:=16#84,
dbNumber:=1, byteOffset:=#i);
PEEK_DWORD(area:=_in_,
dbNumber:=_in_,
byteOffset:=_in_);
Reads the double word referenced by
byteOffset of the referenced data block, I/O or
memory area.
Example: MW200 := PEEK(area:=16#84,
dbNumber:=1, byteOffset:=#i);
PEEK_BOOL(area:=_in_,
dbNumber:=_in_,
byteOffset:=_in_,
bitOffset:=_in_);
Reads a Boolean referenced by the bitOffset
and byteOffset of the referenced data block,
I/O or memory area
Example: MB100.0 := PEEK(area:=16#84,
dbNumber:=1, byteOffset:=#ii, bitOffset:=#j);
POKE(area:=_in_,
dbNumber:=_in_,
byteOffset:=_in_,
value:=_in_);
Writes the value to the referenced byteOffset
of the referenced data block, I/O or memory
area
Example: POKE(area:=16#84, dbNumber:=2,
byteOffset:=3, value:="Tag_1");