Detailed description
2.14 Programming tips with STEP 7
Basic logic functions: PLC Basic program powerline (P3 pl)
Function Manual, 11/2006, 6FC5397-0BP10-2BA0
281
2.14.6
Determining offset addresses for data block structures
General
Another task, which occurs frequently, is symbolic determination of an offset address within
a structured DB, e.g., an ARRAY or STRUCTURE is stored somewhere within the DB. After
loading the address register symbolically with the start address, you might like to access the
individual elements of the ARRAY or STRUCTURE via an address register. One way of
loading the address register symbolically is to use an FC whose input parameter is a pointer.
The address of the ARRAY or STRUCTURE is then assigned symbolically to the input
parameter of this FC in the program. The program code in the FC now determines the offset
address from the input parameter, and passes the offset address in the address register
(AR1) to the calling function. Symbolic addressing is thus possible even with indirect access.
FUNCTION FC 99: VOID
Comment
VAR_INPUT
Addr: POINTER;
//Points to variable
END_VAR
BEGIN
NETWORK
TITLE =
L
P##Addr;
LAR1 ;
//Retrieve pointer from Addr
L
D [AR1,P#2.0];
//Offset part of pointer of variable
LAR1 ;
END_FUNCTION
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 ...