Basic instructions
8.6 Move operations
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
281
Read / Write memory instructions
8.6.8.1
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 mu
st 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.
dbNumber:=_in_,
byteOffset:=_in_);
yte referenced by byteOffset of
the referenced data block, I/O or memory
area.
Example referencing data block:
%MB100 := PEEK(area:=16#84,
dbNumber:=1, byteOffset:=#i);
Example referencing IB3 input:
%MB100 := PEEK(area:=16#81,
dbNumber:=0, byteOffset:=#i); // when
#i = 3
dbNumber:=_in_,
byteOffset:=_in_);
Reads the word referenced by byteOffset of
the referenced data block, I/O or memory
area.
%MW200 := PEEK_WORD(area:=16#84,
dbNumber:=1, byteOffset:=#i);
dbNumber:=_in_,
byteOffset:=_in_);
Reads the double word referenced by
byteOffset of the referenced data block, I/O or
memory area.
%MD300 := PEEK_DWORD(area:=16#84,
dbNumber:=1, byteOffset:=#i);
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
%MB100.0 := PEEK_BOOL(area:=16#84,
dbNu
mber:=1, byteOffset:=#ii,