EtherCAT-IOLink Gateway
Start TwinCAT

  1. Start the TwinCAT "eXtended Automation Engineering XAE".
  2. Open the TwinCAT project select in menu "File->Project/Solution". Select project "source/industrial_comms/ethercat_iolink_gateway/twincat_projects/am64x/TwinCAT Gateway.sln"

  3. The PLC program can be found in the tree:

    "TwinCAT Gateway.PLC.GatewayPlc.GatewayPlc Project.POUs.MAIN (PRG)"

  4. Build the project in menu select "Build->Build solution"

  5. Activate configuration in menu select "TwinCAT->Activate Configuration". Click "OK".

  6. The dialog box is shown, asking to restart in run mode will show up. Click "OK".

    The TwinCAT will detect the connected EtherCAT slave.

  7. Select in menu "PLC->Login".
  8. The dialog box asking to create the Port_851 will show up. Click "Yes".

    Actual values will be shown in the MAIN program part. In this moment all shall be zeros.

  9. Select in menu "PLC->Start" to start the PLC program. The program unpacks the measured distance from the sensor, calculates a related color and send it to the smart light:

| Color | Meaning | | ---— | ----------------------------------— | | green | allowed zone (enough big distance) | | yellow | near the not allowed zone | | red | not allowed zone (too small distance) |

  1. Try to move a metal object before the distance sensor, the light will change the colors in relation to the distance. Actual values will be shown together with the MAIN program.

Next will be shown where can be found the cyclic data of sued IO-Link devices and how to read the VendorID and DeviceID of connected IO-Link devices.

  1. Click in the tree on the "Box1 (KUNBUS EtherCAT ...)".
  2. Click on the "Box 1->TxPDO Module 2->Tx PDO 001". You will see on the right side the measured distance value in raw format.

  3. Click on the "Box 1->RxPDO Module 1->Rx PDO 001". You will see on the right side the control bits for the smart light in the raw format.

  4. Click on the tab CoE-Online. It takes a while to load the object dictionary from the EtherCAT slave.
  5. Click on the object index 0x9000 and 0x9100. It will read and show actual VendorID and DeviceID values of the connected devices.

    You can compare the values with the values in the table below.

| IO-Link Device | DeviceID | VendorID | | ------------— | --------—|--------— | | Balluff BNI007T | 0x00050A05 | 0x00000378 | | Autosen AI 402 | 0x00000061 | 0x00000345 |

It was shown how to setup the hardware with two IO-Link devices. How to start the PLC program to control the distance and how to read which IO-Link devices are currently connected.

Store and Recall Parameters

Gateway parameters can be stored by writing a value of 0x65766173 into CoE object 0x2010

Gateway parameters can be restored by writing a value of 0x64616F6C into CoE object 0x2011