Variables

Variables 1:

Variables 2:

Variables 3:

Variable can be found in different places: Interfaces, Boxes and Channels.

Name is the linked PLC or NC variable name.

IoName is the name of an IO variable shown in System Manager.In case of Variable under Interface and Box, the IoName must be the same as the one in System Manager.

IoDataType is the IEC data type of the PLC variable.

IsInput is used for variable definition in TwinCAT PLC Control. For example, in PLC project,
myInVar AT%I* : BOOL;
myOutVar AT%Q* : BOOL;

%I indicates input, %Q indicates output.

Instance is used to link a variable in a Device like NC or PLC. In case of NC, the Name should be the parent module name, like "Axis1" or "Axis1^Axis_Enc". In case of PLC, in future it would be also used to link non-globe PLC variable, e.g. a Function Block’s variable (under construction)

Destination defines in which Device and Task the Variable should be linked.

An example of Variable is like,

<Variable>
  <Name><![CDATA[nInData1[0]]]></Name>
  <IsInput>true</IsInput>
  <IoName>Counter</IoName>
  <IoDataType>UINT16</IoDataType>
  <Instance>
    <Name><![CDATA[Achse 1 (Oberdruck)^Achse 1 (Oberdruck)_Enc]]></Name>
    <DataType>UINT16ARR2</DataType>
    <IsInput>true</IsInput>
  </Instance>
  <Destination>
    <Device>NC</Device>
    <Task>NC-Task 1 SAF</Task>
  </Destination>
</Variable>

And the linked variable in the device has to be,

<Variable>
  <Name><![CDATA[Achse 1 (Oberdruck)_Enc_In^nInData1^nInData1[0]]]></Name>
  <DataType>UINT16</DataType>
  <IsInput>true</IsInput>
  <LinkedWith>
    <Name><![CDATA[Counter]]></Name>
    <DataType>UINT16</DataType>
    <IsInput>true</IsInput>
    <Device>IO</Device>
  </LinkedWith>
</Variable>
Info:

Info:

The Variable under a Channel is somehow different from the one under Interface or Box. There is generally only one (e.g. in case of a Digital Terminal) or only one interesting variable under a channel. In this case, the IoName could be named as desired, and IsInput could be omitted. However if another non-default IO variable under a Channel is requested to link with a PLC variable, IoName has to be the same as the one in System Manager.

New: since the version 2.0.1.9, the following extension specially for the EtherCAT slaves is added:

IoGroup is obligatroy for an EtherCAT Slave's Variables. It is the name of the variable group as shown in the following figure. IoGroup can have the Index attribute, which should be the same as the Index of the PDO item's Index.

IoNamecan now have the optional Attributes Index, SubIndex and IndexInArray, which should be the same as the ones of the Entries in Process Data of an EtherCAT slave. IndexInArray is necessary if the Variable is an element of an array.

Variables 4: