Communication Configuration and Example Program Usage

This topic provides instructions on setting up the Standard Interface communication based on the EtherNet/IP protocol between a Mitsubishi MELSEC iQ-R Series PLC (with the RJ71EIP91 Network Interface Module) and the Mech-Mind Vision System.

Hardware and Software Requirements

Hardware

  • PLC:

    • Mitsubishi iQ-R series PLC with the RJ71EIP91 Network Interface Module. An R00CPU module PLC is used as an example in the following instructions.

    • Power supply: R61P; Base unit: R33B

  • IPC with HMS IXXAT INpact 40 PCIe interface card installed

  • USB Type A male to USB Mini-B male cable

  • Network switch and Ethernet cables

The connection of the hardware system is shown as below.

hardware connection

Software

Software Description Installed Location

GX Works3 1.081K

Mitsubishi PLC programming software

Computer that is used for PLC sequence programming

SW1DN-EIPCT-BD 01B

EtherNet/IP configuration software

Computer that is used for PLC sequence programming

Mech-Vision & Mech-Viz versions: 1.7.0 or above

Mech-Mind software

IPC

HMS IPconfig

Used for setting up the IP address of the PCIe card

IPC

Please copy and paste the following files to a PC with GX Works3 installed:

  • EDS file: 005A002B003A0100.EDS, which is used to provide the identity information of the IPC in the EtherNet/IP network. Location: Mech-Center/Robot_Interface/EthernetIP in the installation directory where Mech-Vision and Mech-Viz are installed.

  • PLC example program file iQ-R_RJ71EIP91.usl, which contains the following user libraries:

    • M_RJ71EIP91_Class1SetOutputData_00A: communicates via Class1 to obtain the input data of the specified connection.

    • M_RJ71EIP91_Class1GetInputData_00A: communicates via Class1 to set the output data of the specified connection.

    • CameraSignalsMove: used to transfer the vision system signals;

    • CameraTest: used to test the vision system;

    • MM_XXX_XXX function block: used to implement the functions of various interface commands.

    The example program files are stored in Mech-Center/Robot_Interface/EthernetIP/Programming Samples/MITSUBISHI iQ-R PLC EthernetIP in the installation directory where Mech-Vision and Mech-Viz are installed.

Configure IPC and Initiate Communication

Check PCI-e Card and Driver Software

  1. Please make sure that the INpact EIP Slave PCIe interface card has been pressed into the PCI-e slot of the IPC, as shown below.

    install communication board
  2. Start the IPC, go to Start ‣ Device Manager and check if the driver software VCI4 INpact PCIe has been installed.

    device manager

Set up “Robot Communication Configuration”

  1. Click Robot Communication Configuration on the toolbar of Mech-Vision.

  2. In the Robot Communication Configuration window, complete the following configurations.

    1. Click the Select robot drop-down menu, and select Listed robot. Click Select robot model, and select the robot model that you use. Then, click Next.

    2. In the Communication mode area, select Standard Interface for Interface service type and select ETHERNET IP for Protocol.

    3. (Optional) Select Auto enable interface service when opening the solution.

    4. Click Apply.

      ethernet ip
  3. On the main interface of Mech-Vision, make sure that the Robot Communication Configuration switch on the toolbar is flipped and turned to blue.

    interface service

Configure IP address of the PCI-e Card

  1. Use an Ethernet cable to connect the network ports of the IPC and the INpact EIP Slave PCIe.

    After configuring the IP and initiating communication successfully, the Ethernet cable used here can be removed.
  2. Open HMS IPconfig, click the scan icon and unselect “Retrieve IP settings dynamically from a DHCP server”, and then enter the IP address and subnet mask. After configuration, click Apply and exit the software.

set ip

Create and Configure the PLC Project

Create a PLC Project

  1. Open GX Works2, click the New icon in the toolbar. In the New window, set the Series to RCPU, Type to R00, and the Program Language to Ladder, and then click OK.

    create plc 1
  2. In the Add a module window, click Setting Change.

    create plc 2

    In the Options window, select Yes in the drop-down list next to “Use Module Label”, and then click OK. Go back to the Add a module window, and click OK.

    create plc 3
  3. In the Current Connection Destination section of the Connection Destination panel on the left, double-click Connection.

    create plc 4
  4. A Specify Connection Destination Connection window will pop up.

    1. Select Serial USB on the PC side, and select PLC Module on the PLC side, and RCPU will be automatically filled as the PLC Mode.

    2. Click CPU Module Direct Coupled Setting. Select USB in the pop-up window and click Yes.

    3. Go back to the Specify Connection Destination Connection window, and click Connection Test. If a message Successfully connected with the R00CPU pops up, the GX Works3 software has successfully communicated with the PLC.

    4. Click OK in the Specify Connection Destination Connection window and go back to the main interface of GX Works3.

    create plc 5
  5. In the navigation window on the left, expand Parameter and double-click System Parameter, and then a System Parameter window will pop up.

    1. In the I/O Assignment tab of the System Parameter window, select Base/Power/Extension Cable Setting, click the button in the Base column to the right of Main, and a Model Name Selection window will pop up.

    2. In the Model Name Selection window, select the base module and power supply module according to the actual situation, and then click OK.

      create plc 6

      Click OK in the pop-up window as shown below.

      create plc 7
    3. In the I/O Assignment tab of the System Parameter window, select I/O Assignment Setting, click the button in the Module Name column next to 0 (0-0), and an Add New Module window will pop up.

    4. In the Add New Module window, set the Module Type to Network Module and the Module Name to RJ71EIP91, and then click OK in each of the two windows.

      create plc 8
    5. Click OK in the pop-up window as shown below.

      create plc 9
  6. In the navigation window on the left, expand Parameter and double-click the newly added 0000:RJ71EIP91, and the Module Parameter window will appear.

    1. In the Module Parameter window, select Basic Setting, expand the Own Mode Setting and double-click the blank space next to IP Address.

    2. In the Setting for IP Address window, set the IP address and subnet mask, and click OK.

create plc 10

Download Hardware Configuration to PLC

  1. Select Program in the Navigation panel on the left, and select Convert  Rebuild All in the menu bar.

    configure plc 1
  2. In the Rebuild All window, click Options, and an Options window will pop up.

    configure plc 2
    1. In the Options window, click Basic Setting on the left, and select Yes for “Reassign Labels in Executing Rebuild All”, and then click OK.

    2. Go back to the Rebuild All window and click OK.

      configure plc 3
  3. After the program is converted successfully, click Online  Write to PLC in the menu bar.

    configure plc 4
  4. In the Online Data Operation window, click the Write tab, and click Parameter + Program, and then click Execute.

    configure plc 5
    1. Click Yes in the pop-up window as shown below.

      configure plc 6
    2. If the system safety can be ensured, select Yes.

      configure plc 7
    3. Select Yes to all for “Are you sure you want to overwrite it?”.

      configure plc 8
    4. After downloading successfully, an alert message as shown below will pop up. If the system safety can be ensured, select Yes.

      configure plc 9
    5. Click OK in the Completed window. Go back to the Online Data Operation window and click Close.

      configure plc 10
  5. Reboot the PLC to make the configurations take effect.

Install EDS file and Configure Communication

  1. Go back to the 0000:RJ71EIP91 Module Parameter window, double-click the EtherNet/IP Configuration Tool icon to start the EIP Configuration Tool for RJ71EIP91 configuration software.

    install file 1
  2. An Add New Element window will pop up, enter the IP address of the RJ71EIP91 module, which should be the same as the IP address of the “0000:RJ71EIP91 module parameter” set in GX Works3, and then click OK.

    install file 2
  3. In the EIP Configuration Tool for RJ71EIP91 window, expand the Device Library, and select EtherNet/IP Devices. Click Add and an EDS Management window will pop up.

    install file 3
    1. In the EDS Management window, click Next.

      install file 4
    2. Click Browse, and select the EDS file you need in the pop-up window, and then click Next. Please copy the EDS file from the IPC in advance.

      install file 5
    3. Click Next.

      install file 6
    4. Click OK.

      install file 7
  4. After the EDS file is added successfully, expand EtherNet/IP Device, right-click Ixxat INpact EtherNet/IP™, and select Insert in Configuration to connect to the EtherNet/IP network. The Ixxat INpact EtherNet/IP™ Revision window will pop up.

    install file 8

    Click the General tab and set the IP address of the vision system slave device. The IP address set in this example is 192.168.1.10, which should be the same as the IP address set in HMS IPConfig.

    install file 9
    1. In the Connection tab, click General, and change the value of Input Mode to Point to Point. Then record the value of the Input Size and Output Size, and click OK.

    install file 10

Download PLC EtherNet/IP Network Configuration to PLC

  1. If the “Ixxat INpact EtherNet/IP™” device is added successfully, the device option as shown below will appear in the window. Click the Online command icon in the toolbar.

    download file 1
  2. Select Yes for “Do you want to save the configuration before to go online?” to switch to the online mode.

    download file 2
  3. In the Online communication mode, click the Download the current configuration in the module icon to download the current parameters to the EtherNet/IP communication module RJ71EIP91.

    download file 3
    1. Select configuration.apa in the pop-up window to facilitate the downloading, uploading, and editing of the configuration file with the .apa file extension. Then click Download. Then click Download.

      download file 4
    2. Click OK in the pop-up window as shown below.

      download file 5
  4. Reboot the PLC to make the configurations take effect.

Import Example Program and Download to PLC

Import Mech-Mind Example Programs

Before you add the example program to a project already in use, it is recommended to import it to a new project and test it first.
  1. Go back to the main interface of GX Works3. Select Project  Library Operation  Register to Library List  User Library.

    import file 1

    Click OK in the pop-up window as shown below.

    import file 2
  2. In the Register Library to Library List window, select the example program file “iQ-R_RJ71EIP91.usl” and click Open. Please copy the file from the IPC in advance.

    import file 3
  3. Go back to the GX Works3 software window, select two example program files “CameraSignalsMove” and “CameraTest” in the Element Selection panel on the right. Then right-click the example programs and select Add to Project  Scan.

    import file 4

    Click Yes in the pop-up window as shown below.

    import file 5
  4. Go back to the GX Works3 software window, check whether the example programs, function block, and labels are imported successfully and appear in the Project panel. Then click Convert  Rebuild All in the menu bar.

    import file 6

    Click OK in the pop-up window as shown below.

    import file 7

Download PLC Program to PLC

  1. After the program is converted successfully, click Online  Write to PLC in the menu bar.

    download plc 1
  2. In the Online Data Operation window, click the Write tab, and click Parameter + Program, and then click Execute.

    download plc 2
    1. Click Yes in the pop-up window as shown below.

      download plc 3
    2. If the system safety can be ensured, select Yes in the pop-up window as shown below.

      download plc 4
    3. Select Yes to all for “Are you sure you want to overwrite it?”.

      download plc 5
    4. After downloading successfully, an alert message as shown below will pop up. If the system safety can be ensured, select Yes.

      download plc 6
    5. Click OK in the Completed window. Go back to the Online Data Operation window and click Close.

    download plc 7

Check Communication

  1. Go back to the GX Works3 software window, double-click ProgramBody in the Navigation Panel.

    establish communication 1
  2. Select Online  Monitor  Start Monitoring (All Windows) in the menu bar.

    establish communication 2

    If the connection is established successfully, the monitor value of FromCamera.HEARTBEAT will keep changing.

    establish communication 3
  3. The PLC is successfully connected if the following message is displayed in the Console tab of Mech-Vision Log panel: Connect to ETHERNET IP controller successfully. If you don’t see this log message, please check:

    1. If the hardware is properly connected;

    2. If the Interface Service has been started successfully in Mech-Vision;

    3. If the PLC program has been successfully downloaded to the PLC.

Test with Mech-Vision/Mech-Viz Project

This section introduces how to use the example program function block to trigger the Mech-Vision project to obtain vision points and trigger the Mech-Viz project to obtain the planned path.

Prerequisites

  1. Mech-Vision project(s): Right-click the solution and select Autoload Solution. Projects in the solution are also autoloaded. Meanwhile, the project number will show up before each project name.

  2. Mech-Viz project: Right-click the project name in Resources of Mech-Viz and select Autoload Project.

    The Mech-Viz project used for testing should contain a “Branch by Msg” Step that has been renamed to 1 as shown below.

    preparation 4

Run Mech-Vision Project and Obtain Vision Points

Configure Programs

  1. Go back to the GX Works3 software window, double-click the program body of CameraTest, and set the status of ToCamera.COMM_ENABLE to be always on.

    test vision 1
  2. Click the MM_Start_Vis function block and set the values for the inputs as shown below.

    1. Set the value of Vision_Proj_Num to 1, then project No.1 in Mech-Vision will be started.

    2. Set the value of Req_Pose_Num to 0, which means the Mech-Vision project will send all the vision points.

    3. Setting the value of Robot_Pose_Type to 0 indicates that the project is in eye-to-hand mode, and the image-capturing pose is not needed.

    test vision 2

Trigger Mech-Vision Project to Run

  1. In the window of GX Works3, right-click the Camera_User.Start_Vis label on the input side of MM_Start_Vis, select Debug  Modify Value and modify the value to 1 to trigger the Mech-Vision project to run. Then reset the value to 0.

    test vision 3
  2. Check whether the returned value of STATUS_CODE is 1102.

    1. Select Online  Watch  Register to Watch Window  Watch Window 1 in the menu bar.

      test vision 4
    2. In the Watch 1 window, find the FromCamera label in the Name column.

      test vision 5
    3. Expand the levels and check the returned value of STATUS_CODE.

    test vision 6
If the Mech-Vision project is started successfully, the status code 1102 will be returned. Otherwise, the corresponding error code will be returned. Please refer to Status Codes and Troubleshooting for troubleshooting.

Obtain Vision Points from Mech-Vision

  1. In the window of GX Works3, right-click the Camera_User.Get_VisData label on the input side of MM_Get_VisData, select Debug  Modify Value and modify the value to 1 to get vision points from Mech-Vision. Then reset the value to 0.

    test vision 7
  2. Check the returned value of STATUS_CODE in the Watch Window 1.

    test vision 8
    If the vision points are obtained successfully from Mech-Vision, the status code 1100 will be returned. Otherwise, the corresponding error code will be returned. Please refer to Status Codes and Troubleshooting for troubleshooting.
  3. Check the returned value of Target_Pose.

    1. Select Online  Watch  Register to Watch Window  Watch Window 2 in the menu bar.

      test vision 9
    2. In the Watch 2 window, find the Camera_User label in the Name column.

      test vision 10
    3. Expand the levels and check the returned values of Target_Pose. The example in the figure below received 2 poses. Divide the transferred values by 10000 to obtain the actual pose data.

    test vision 11

Automate the Process of Getting Vision Result from Mech-Vision

The previous section introduces how to manually obtain vision results from Mech-Vision. To automate the process of obtaining vision results from Mech-Vision, connect the programs as the following example.

get vis results automatically 1
get vis results automatically 2
get vis results automatically 3

Run Mech-Viz Project and Obtain Planned Path

Configure Programs

  1. In the window of GX Works3, right-click the Camera_User.Start_Empty label on the input side of MM_Get_VisData, select Debug  Modify Value and modify the value to 1 to clear the previously obtained vision result. Then reset the value to 0.

    test viz 1

    Check the value of Target_Pose after the vision result is cleared in the Watch Window 2.

    test viz 2
  2. Click the MM_Set_Branch function block and set the input values as shown below.

    1. Set the value of Branch_Name to 1, and the project will execute along the Branch by Msg Step whose Step ID is 1.

    2. Set the value of Branch_Exit_Port to 1, and the Mech-Viz will take exit port 1 for the Branch by Msg Step whose Step ID is 1.

    test viz 3
  3. Click MM_Get_VizData, set the value of Request_Pose_Type to 1, and Mech-Viz will send data as joint positions.

    test viz 4

Trigger Mech-Viz Project to Run

  1. In the window of GX Works3, right-click the Camera_User.Start_Viz label on the input side of MM_Start_Viz, select Debug  Modify Value and modify the value to 1 to trigger the Mech-Viz project to run. Then reset the value to 0.

    test viz 5
  2. Check the returned value of STATUS_CODE in the Watch Window 1.

    test viz 6
If the Mech-Viz project is started successfully, the status code 2103 will be returned. Otherwise, the corresponding error code will be returned. Please refer to Status Codes and Troubleshooting for troubleshooting.

Set Mech-Viz Branch Exit Port

  1. In the window of GX Works3, right-click the Camera_User.Set_Branch label on the input side of MM_Set_Branch, select Debug  Modify Value and modify the value to 1 to select the exit port of the branch. Then reset the value to 0.

    test viz 7
  2. Check the returned value of STATUS_CODE in the Watch Window 1.

    test viz 8
    If the branch is set successfully, the status code 2105 will be returned. Otherwise, the corresponding error code will be returned. Please refer to Status Codes and Troubleshooting for troubleshooting.

Obtain Mech-Viz Planned Path

  1. In the window of GX Works3, right-click the Camera_User.Get_VizData label on the input side of MM_Get_VizData, select Debug  Modify Value and modify the value to 1 to get the planned path from Mech-Viz. Then reset the value to 0.

    test viz 9
  2. Check the returned value of STATUS_CODE in the Watch Window 1.

    test viz 10
    If the planned path is obtained successfully, the status code 2100 will be returned. Otherwise, the corresponding error code will be returned. Please refer to Status Codes and Troubleshooting for troubleshooting.
  3. Click MM_Get_VizData and you can see the value of Send_Pose_Num is 10, which indicates that 10 sets of joint positions are obtained in this example program.

    test viz 11
  4. Check the returned values of Target_Pose in the Watch Window 2. Divide the transferred values by 10000 to obtain the actual pose data.

    test viz 12

Automate the Process of Getting Planned Path from Mech-Viz

The previous section introduces how to manually obtain the planned path from Mech-Viz. To automate the process of obtaining the planned path from Mech-Viz, connect the programs as the following example.

get viz results automatically 1
get viz results automatically 2
get viz results automatically 3
get viz results automatically 4
get viz results automatically 5

We Value Your Privacy

We use cookies to provide you with the best possible experience on our website. By continuing to use the site, you acknowledge that you agree to the use of cookies. If you decline, a single cookie will be used to ensure you're not tracked or remembered when you visit this website.