P3: Basic PLC Program for SINUMERIK 840D sl
13.15 Programming tips with STEP 7
Basic Functions
1076
Function Manual, 09/2011, 6FC5397-0BP40-2BA0
13.15
Programming tips with STEP 7
Some useful tips on programming complex machining sequences in STEP7 are given below. This is essentially
handling of the data type POINTER or ANY.
Fundamental tips on the structure of the data type POINTER and ANY see:
References:
STEP 7-Manual; Chapter: "Designing user programs" > "Register of CPU and saving of data"
13.15.1
Copying data
Copying variants
For the high-speed copying of data from one DB into another it is recommended
• for larger data quantities to use the system function SFC BLKMOV or SFC FILL, because here a high-speed
copying takes place.
• the routine given below is for smaller data quantities, because the supply of ANY parameter to the SFCs
consumes additional time.
Example
13.15.2
ANY and POINTER
The following programming examples show the programming mechanism. They demonstrate how input/output
and transit variables (VAR_INPUT, VAR_OUTPUT, VAR_IN_OUT) are accessed by data types "POINTER" or
"ANY" within an FC or FB. The access operations are described in such a way that a part symbolic method of
programming can be used.
Code
Comment
// DB xx.[AR1] is the source
// DI yy.[AR2] is the destination
OPEN
DB 100;
//Source DB
LAR1
P#20.0;
//Source start address on data byte 20
OPEN
DI 101;
//Destination DB
LAR2
P#50.0;
//Destination start address on data byte 50
//AR1, AR2, DB, DI loaded beforehand
L
4;
//Transfer 8 bytes
M001:
L
DBW [AR1,P#0.0];
//Copy word-oriented
T
DIW [AR2,P#0.0];
+AR1
P#2.0;
+AR2
P#2.0;
TAK;
LOOP
M001;