Detailed description
2.14 Programming tips with STEP 7
Basic logic functions: PLC Basic program powerline (P3 pl)
272 Function Manual, 11/2006, 6FC5397-0BP10-2BA0
2.14 Programming tips with STEP 7
2.14.1 General
General
Some useful tips on programming complex machining sequences in STEP7 are given below.
This information concentrates mainly on the handling of data type POINTER and ANY.
Detailed information about the structure of data types POINTER and ANY can be found in
Chapter "CPU register and storage of data" in STEP7 manual "Designing user programs".
2.14.2 Copying data
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.
The following is an example of how to copy data at high speed from one DB into another.
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;