Siemens SINUMERIK 840Di Function Manual page 1177

Basic machine
Hide thumbs Also See for SINUMERIK 840Di:
Table of Contents

Advertisement

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
VAR_INPUT
Addr: POINTER;
END_VAR
BEGIN
NETWORK
TITLE =
L
P##Addr;
LAR1 ;
L
D [AR1,P#2.0];
LAR1 ;
END_FUNCTION
Power Line Basic PLC Program (P3)
Function Manual, 08/2005 Edition, 6FC5397-0BP10-0BA0
2.14 Useful tips on programming with STEP 7
Comment
//Points to variable
//Retrieve pointer from Addr
//Offset part of pointer of variable
Detailed description
2-265

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents