Detailed description
2.14 Programming tips with STEP 7
Basic logic functions: PLC basic program solution line (P3 sl)
Function Manual, 11/2006, 6FC5397-0BP10-2BA0
255
2.14.3.2
Use of POINTER and ANY in FC if POINTER or ANY is available as parameter
Description of Functions
FC 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 in FC, if POINTER or ANY are present as parameters
FUNCTION FC 99: VOID
Comment
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;
LAR1 ;
//Retrieve pointer
L
W [AR1,P#0.0];
//Retrieve DB number
T
#dbchr;
L
D [AR1,P#2.0];
//Offset part of pointer
LAR1 ;
AUF DB [#dbchr];
//Open DB of variables
L B [AR1,P#40.0];
//Retrieve byte value using pointer with
//address offset 40
//ANY
L
P##Addr1;
LAR1 ;
//Retrieve ANY
L
B [AR1,P#1.0];
//Retrieve type
Summary of Contents for SINUMERIK 840D sl
Page 282: ...Index Basic logic functions Acceleration B2 64 Function Manual 11 2006 6FC5397 0BP10 2BA0 ...
Page 388: ...Basic logic functions Travel to fixed stop F1 Function Manual 11 2006 6FC5397 0BP10 2BA0 52 ...
Page 962: ...Index Basic logic functions Emergency Stop N2 20 Function Manual 11 2006 6FC5397 0BP10 2BA0 ...
Page 1704: ...Constraints Basic logic functions Spindles S1 94 Function Manual 11 2006 6FC5397 0BP10 2BA0 ...
Page 1716: ...Index Basic logic functions Spindles S1 106 Function Manual 11 2006 6FC5397 0BP10 2BA0 ...
Page 1996: ...Index Basic logic functions Tool Offset W1 208 Function Manual 11 2006 6FC5397 0BP10 2BA0 ...
Page 2150: ...Table of contents Basic logic functions Appendix 4 Function Manual 11 2006 6FC5397 0BP10 2BA0 ...
Page 2184: ...Glossary Basic logic functions Appendix 38 Function Manual 11 2006 6FC5397 0BP10 2BA0 ...