Mapping variables

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Mapping variables

mapp Services V5.16

AT (PLC | '<Task name>')

Keyword AT indicates that the variable declaration is mapping the existing process variables.

If a process variable of a complex data type (e.g. structure variable) is mapped, its data type can be obtained entirely from the system without requiring an explicit type declaration. This happens if the data type is not known prior to the variable mapping.

If a process variable is a function block instance and the declared data type name matches the name of an existing PLC function block, then the function block definition can also be obtained automatically. For additional information, see Function blocks.

Information:

Variables that contain references and multidimensional arrays cannot be determined automatically by the system. Their data types must therefore be explicitly made known before assignment.

Examples

Accessing a global process variable

VAR {AT PLC}
  AxisCount : UDINT;
END_VAR

Accessing a local process variable

//Process variable in Tool PLC task
VAR {AT 'Tool'}
  Angle : LREAL;
END_VAR

Accessing complex data types

Global process variable "Command" and the associated data type definition is declared on the PLC. Data type "CommandType" is determined automatically.

variables_1

VAR {AT PLC}
    Command : CommandType; (*CommandType is declared only on the PLC side*)
END_VAR
PROGRAM _MAIN
    Command.Id := 1001;
    Command.Data[0] := 16#A3;
END_PROGRAM