2.14.3
ANY and POINTER
2.14.3.1
POINTER or ANY variable for transfer to FC or FB
With version 1 or later of STEP7 it is possible to define a POINTER or an ANY in
VAR_TEMP. The following two examples show how an ANY can be supplied.
Example 1 Transfer ANY parameter via a selection list to another FB (FC)
Several ANY parameters are defined in an FB (FC). A specific ANY parameter must now be
chosen from a selection list for transfer to another FB (FC). This can only be done by means
of an ANY in VAR_TEMP. 1 to 4 can be set in parameter "WhichAny" in order to select
Addr1 to Addr4.
Note
Address register AR2 is used in the block. However, this address register AR2 is also used
for multiinstance DBs. For this reason, this FB should not be declared as multi-instance DB.
FUNCTIONBLOCK FB 100
CODE_VERSION1
VAR_INPUT
WhichAny : INT ;
Addr1 : ANY ;
Addr2 : ANY ;
Addr3 : ANY ;
Addr4 : ANY ;
END_VAR
VAR_TEMP
dbchr : WORD ;
Number: WORD ;
type : BYTE ;
Temp_addr : ANY ;
END_VAR
BEGIN
NETWORK
TITLE =
WhichAny;
L
DEC 1;
P#10.0;
L
*I;
LAR2;
Basic logic functions: PLC Basic program powerline (P3 pl)
Function Manual, 11/2006, 6FC5397-0BP10-2BA0
2.14 Programming tips with STEP 7
Comment
//starting from STEP 7 Version 2 for deactivating the multi-
instance DB
//Observe predetermined order
//10 bytes per ANY
Detailed description
273