Operator ‘ADR’ΒΆ

This operator is an extension of the IEC 61131-3 standard.

ADR yields the address of its argument in a DWORD. You can pass this address to the manufacturer functions or assign them to a pointer in the project.

Hint

As opposed to CoDeSys V2.3, you can use the ADR operator with function names, program names, function block names, and method names. Therefore, ADR replaces the INDEXOF operator. When using function pointers, please note that you can pass a function pointer to external libraries, but it is not possible to call a function pointer from within CODESYS. To enable a system call (runtime system), you must set the respective object property (Build tab) for the function object.

Caution

When you apply an online change, address contents can shift, causing POINTER variables to reference invalid memory ranges. To avoid problems, make sure that CODESYS updates pointer values in every cycle.

Caution

Do not return Pointer-TO variables of functions and methods to the caller or assign them to global variables.

Examples

ST:

dwVar := ADR(bVAR);