Detailed Description
2.12 Block descriptions
PLC Basic Program Solution Line (P3 sl)
Function Manual, 08/2005 Edition, 6FC5397-0BP10-0BA0
2-229
2.12.30 Useful Tips on Programming with STEP 7
2.12.30.1 General
General
Some useful tips on programming complex machining sequences in STEP7 are given in the
following. 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.12.30.2 Copying data
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 42; //Transfer 84 bytes
M001:
L DBW [AR1,P#0.0]; //Copy word-oriented
L DBW [AR1,P#0.0];
T DIW [AR2,P#0.0];
+AR1 P#2.0;
+AR2 P#2.0;
TAK;
LOOP M001;
2.12.30.3 ANY and POINTER
Multi-instance DB
With version 2 and higher of STEP 7, FBs might have a multi-instance capability, i.e., they
might incorporate multi-instance DBs. The primary characteristic of multi-instance DBs is that
they can be used for various instances of FBs (see STEP 7 documentation), thus allowing
the DB data quantity to be optimized.
Multi-instance DBs should be activated only when they are actually going to be used since
they increase the runtime and code size of the FBs.