The leader in industrial automation and control solutions

Before setting up a CODESYS project to communicate with an iR-ECAT module, it is assumed that the development PC running CODESYS and the cMT device running the CODESYS runtime are connected via Ethernet, and the cMT device is connected to the iR-ECAT module using the EtherCAT Protocol. For information on how to wire the iR-ECAT, please see the installation guide pinout diagrams for the cMT device in use, as well as the installation guide and user manual for the iR-ECAT on DIP switch settings and wiring.

Connect iR-ECAT to CODESYS

Follow these steps to connect an iR-ECAT product to CODESYS

  1. Add Device

    Right click on Device (Weintek Built-in CODESYS) and select Add Device
    Right-clicking the Device (Weintek Built-in CODESYS) gives you a popup menu; select the 'add device' entry.
  2. Add EtherCAT Master

    In the Add Device window, check the Display all versions checkbox and then select FieldBusses -> EtherCAT -> Master -> EtherCAT Master Version 3.5.10.0 and click Add Device:
    Adding an EtherCAT adapter in CODESYS. Version 3.5.10.0 is the desired version, you will have to select the 'display all versions' checkbox to see it.
  3. Select “Device” from the newly added EtherCAT Master to add the iR-ECAT slave device

    Select the newly added EtherCAT Master device, and then in the Add Device window, select Fieldbusses -> EtherCAT -> Slave -> Weintek Labs., Inc. – Coupler -> iR-ECAT and click Add Device
    Adding an EtherCAT Slave device, specifically the iR-ECAT which can be found under the "Weintek Labs, inc - Coupler" folder.
  4. Set the Gateway address for the EtherCAT interface (MAC address)

    Double click on the newly added EtherCAT Master device to open the settings. In the General settings tab, click the Source Address (MAC) Browse button to set the gateway address to use for the EtherCAT interface.
    This should match the MAC address of the cMT-X device’s CODESYS LAN port
    In the General settings tab, click the Source Address (MAC) Browse button to set the gateway address to use for the EtherCAT interface.
  5. Set the Node IDs

    Double click on the iR_ECAT device to open the device settings. In the General tab, check the Enable Expert Settings checkbox. In the Identification section, select the Configured Station Alias radio button, and for the value field, enter the node ID set on the X1 and X10 dip switches on your iR-ECAT device.
    These may be set to any ID except 00 00. Our example is set to 00 01.
    Setting the Node ID in the General tab of the iR-ECAT configuration.
  6. Add all attached I/O modules (Method A: Scan for Devices)

    Right click the EtherCAT Master device and click Scan For Devices.

    If the gateway for the EtherCAT Master device is set up, and the PC is able to login to the CODESYS device, this will automatically scan the connected iR-ECAT module and find all attached IO modules, allowing them to be added all at once.

    In this example, only a DM16-P is connected.

    Adding connected I/O modules automatically via the 'scan for devices' option
  7. Add all attached I/O modules (Method B: Manually)

    Right click the iR_ECAT device and click Add Device. In the Add Device window, select Fieldbusses -> EtherCAT -> Module and then add each connected IO module in the order they are connected to the base module.
    Once again, in this example only a DM16-P is connected.
    Adding devices individually and in order manually. In our example we only have a single device: iR-DM16-P.
  8. Add Variables in the PLC_PRG Program

    Add variables in the PLC_PRG program to channel to the connected IO.
    In this example, we will simply add one Boolean for each IO
    Adding variables in the PLC_PRG window. For our purposes we're adding one Boolean variable for each I/O in our module.
  9. Map the variables to the I/O

    Double click in the iR_ECAT device and go to the EtherCAT I/O Mapping tab. There, map the newly created variables to the IO connected.
    In this example, we only have an iR-DM16-P connected, so we will connect our 8 read and write variables to the input and output bits
    Double click in the iR_ECAT device and go to the EtherCAT I/O Mapping tab. There, map the newly created variables to the IO connected.
  10. Ensure variables are set to update automatically

    While in the EtherCAT I/O Mapping tab of the iR_ECAT device, set the Always update variables to Enabled 2 (always in bus cycle task):
    Configuring all the BOOL variables to always update. This is a dropdown selection at the bottom of the I/O Mapping window.
  11. Enable PD0 Assignment and Configuration boxes

    Finally, in the iR_ECAT device settings, go to the Expert Process Data tab and check the PDO Assignment and PDO Configuration checkboxes in the Download section
    enable both the PD0 Assignment and PD0 Configuration check boxes in the Download section at the bottom of the window.