P3: Basic PLC Program for SINUMERIK 840D sl
13.15 Programming tips with STEP 7
Basic Functions
1078
Function Manual, 09/2011, 6FC5397-0BP40-2BA0
13.15.2.2 Use of POINTER and ANY in FB
Function
FB 99 has inputs parameters that are defined as POINTER or ANY.
The example shows a body program via which the subcomponents of the POINTER or ANY can be accessed. In
this case, the DB parameterized with POINTER or ANY is opened and the address offset stored as a crossarea
pointer in address register AR1, thus allowing access to data elements of variables (generally structures and
arrays) that are addressed via the POINTER, ANY.
This access operation is described at the end of the relevant program sequence in the example. With data type
ANY, it is also possible to execute a check or branch when the variable is accessed based on the data type and
the number of elements involved.
Example
T
#typ;
L
W [AR1,P#2.0];
//Retrieve amount
T
#Amount;
L
W [AR1,P#4.0];
//Retrieve DB number
T
#dbchr;
L
D [AR1,P#6.0];
//Offset part of pointer
LAR1 ;
OPEN
DB [#dbchr];
//Open DB of variables
L
B [AR1,P#0.0];
//Retrieve byte value using ANY
Code
Comment
FUNCTIONBLOCK FB 99
VAR_INPUT
Row : BYTE ;
Convert : BOOL ;
//Activate numerical conversion
Addr: POINTER;
//Points to variable
Addr1 : ANY ;
END_VAR
VAR_TEMP
dbchr : WORD ;
Number: WORD ;
type : BYTE ;
END_VAR
BEGIN
NETWORK
TITLE =
//POINTER
L
P##Addr;
Code
Comment
Содержание SINUMERIK 828D Turning
Страница 34: ...Basic Functions 34 Function Manual 09 2011 6FC5397 0BP40 2BA0 ...
Страница 146: ...A3 Axis Monitoring Protection Zones 2 6 Data lists Basic Functions 146 Function Manual 09 2011 6FC5397 0BP40 2BA0 ...
Страница 328: ...F1 Travel to fixed stop 6 5 Data lists Basic Functions 328 Function Manual 09 2011 6FC5397 0BP40 2BA0 ...
Страница 816: ...K2 Axis Types Coordinate Systems Frames 10 9 Data lists Basic Functions 816 Function Manual 09 2011 6FC5397 0BP40 2BA0 ...
Страница 1198: ...P4 PLC for SINUMERIK 828D 14 6 Function interface Basic Functions 1198 Function Manual 09 2011 6FC5397 0BP40 2BA0 ...
Страница 1752: ...Appendix 20 2 Overview Basic Functions 1752 Function Manual 09 2011 6FC5397 0BP40 2BA0 ...
Страница 1774: ...Glossary Basic Functions 1774 Function Manual 09 2011 6FC5397 0BP40 2BA0 ...