ADR
This address operator is not specified by the standard IEC 61131-3.
ADR
returns the address of its argument in a DWORD. This address can be assigned to a pointer within the project.
ADR
operator with function names, program names, function block names, and method names.
Refer to the chapter Pointers and consider that function pointers can be passed to external libraries. Nevertheless, there is no possibility to call a function pointer within EcoStruxure Machine Expert. In order to enable a system call (runtime system), set the respective object property (in the menu ) for the function object.
VAR
piAddress1: POINTER TO INT;
iVar1 : INT := 5;
lwAddress2 : LWORD;
iVar2 : INT := 10;
xwAddress3 : _XWORD;
iVar3 : INT;
END_VAR
piAddress1 := ADR(iVar1); // piNumber is assigned to address of iVar1
lwAddress2 := ADR(iVar2); // works for 64 bit run time system
xwAddress3 := ADR(iVar3); // works for 32 bit and 64 bit systems
Executing the command
can move variables to another place in the memory. There is an indication during online change if copying is necessary.
The shift of variables may have the effect that POINTER TO
variables point to invalid memory.
WARNING | |
---|---|
POINTER TO
variables of functions and methods should not be returned to the caller of this function or passed to global variables.