<< Click to Display Table of Contents >> Navigation: »No topics above this level« Dynamic variables |
mapp Services V5.16
Navigation over dynamic data is supported using dereference operator "^". This operator is used to continue a variable reference through levels of "REFERENCE TO" data types if automatic dereferencing is not enabled.
Reference variables are automatically dereferenced.
Structure members are not dereferenced.
TYPE
Tool : STRUCT
id : DINT;
radius : LREAL;
END_STRUCT;
ToolSet : STRUCT
main : Tool;
alt : REFERENCE TO Tool;
END_STRUCT;
END_TYPE
VAR
Ts : ToolSet;
Tptr : REFERENCE TO ToolSet;
END_VAR
PROGRAM _MAIN
(* Configure REFERENCE TO addresses *)
Tptr ACCESS ADR(Ts); (* Use ACCESS for auto-dereferenced variable *)
Tptr.alt := ADR(Tptr.main);
(* Access through REFERENCE TO data members *)
Tptr.alt^.id := 1;
END_PROGRAM