Detailed description
2.14 Useful tips on programming with STEP 7
Power Line Basic PLC Program (P3)
2-262 Function Manual, 08/2005 Edition, 6FC5397-0BP10-0BA0
1. An ANY parameter that has already been compiled must be transferred to another FB
(FC). This can be done only by means of an ANY stored in VAR_TEMP
FUNCTIONBLOCK FB 100 Comment
VAR_INPUT
DBNumber: INT ;
DBOffset : INT ;
Data type: INT ;
Number: INT ;
END_VAR
VAR_TEMP
dbchr : WORD ;
Temp_addr : ANY ;
END_VAR
BEGIN
NETWORK
TITLE =
L P##Temp_addr;
LAR1 ; //Retrieve pointer from VAR_TEMP
L B#16#10; //ANY identifier
T LB [AR1,P#0.0];
L Data type;
T LB [AR1,P#1.0];
L Amount;
T LW [AR1,P#2.0];
L DBNumber;
T LW [AR1,P#4.0];
L DBOffset;
SLD 3; //Offset is a bit offset
T LD [AR1,P#6.0];
CALL FB 101, DB 100
(ANYPAR := #Temp_addr); //ANYPAR is data type ANY
2.14.4 Multi-instance DB
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.