The leader in industrial automation and control solutions

Before setting up a CODESYS project to communicate with an iR-COP 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-COP module using the CAN bus.

For information on how to wire the CAN bus, 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-COP on DIP switch settings and wiring.

Connect iR-COP to CODESYS

Follow these steps to connect an iR-COP 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 a CANbus adapter

    In the Add Device window, first check the Display all versions checkbox, and then select Fieldbusses -> CANbus -> CANbus version 3.5.10 and click Add Device
    Adding a CANbus 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 CANbus adapter to add CAN Open Manager

    Select the newly added CANbus (CANbus) device, and then in the Add Device window, select FieldBuses -> CANopen -> CANopenManager -> CANopen_Manager version 3.5.10
    Selecting the CANbus adapter, and adding a nested device (CAN Open Manager) underneath it.
  4. From CAN Open Manager, Add iR-COP Remote Device

    Select the newly added CANopen_Manager, and then in the Add Device window, select Fieldbusses -> CANopen -> Remote Device -> iR-COP Revision 3, FileVersion 1.3
    Adding the iR-COP Remote Device. File Version 1.3 is the correct instance to choose.
  5. From iR-COP device, add the modules physically connected to the iR-COP

    Select the newly added iR-COP device, and then in the Add Device window, add each module connected to the iR-COP in the order connected. In this example, we only have an iR-DM16-P connected.
    Add modules that are physically connected to the iR-COP device, in the order of which they are connected. In our example, we have a single iR module, the iR-DM16-P
  6. Configure COM port baud rate

    Double click on the CANbus (CANbus) device and configure the correct baud rate for the iR-COP in the General tab. This should match the baud rate set on the DIP switches of the iR-COP
    Selecting the CAN bus Adapter, general tab. Enter the baud rate corresponding to the physically configured baud rate of your device.
  7. Add Tags to CODESYS program

    To map tags to the CANopen device, first add tags to the PLC_PRG application.
    In this example, BOOL tags are used as the only IO module connected to the iR-COP is an iR-DM16-P.
    Creating BOOL tags that will correspond to the I/O module. In this case, our iR-DM16-P
  8. Set iR-COP Node IDs

    Double click on the iR_COP device and go to the General tab. Here, set the Node ID to match the X1 and X10 DIP switch Node setting on the iR-COP device
    In this example, we have the Node set to 00 01, so we set the Node ID to 1
    Configuring the Node ID from the General tab of the iR-COP device in the CODESYS program. The Node ID must match with the hardware DIP Switch Node setting on the device.
  9. MAP the program variables to the physical I/O

    Now map the variables in PLC_PRG to the IO modules attached.
    In this example, we are only using a iR-DM16-P, so we will double click that module, navigate to the CANopen-Module I/O Mapping tab, and connect each created Boolean variable and attach them to the corresponding IO
    Mapping the Individual BOOLs to the physical I/O on the module
  10. Ensure Variables are set to update automatically

    Still on the CANopen I/O Mapping tab, set 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.