Communication Configuration and Example Program Usage (PLC with Built-in Ethernet Port)

This topic provides instructions on setting up the Standard Interface communication based on the MC protocol between a Mitsubishi MELSEC iQ-R Series PLC (with Built-in Ethernet Port) and the Mech-Mind Vision System.

The communication protocol used here is Seamless Message Protocol (SLMP). The 3E frame of SLMP has the same message format as the 3E frame of the QnA series in the MC protocol. Therefore, devices using the 3E frame of the QnA series in the MC protocol (such as the vision system) can communicate with Mitsubishi iQ-R series PLCs by using SLMP.

Hardware and Software Requirements

Hardware

  • Mitsubishi iQ-R Series PLC: with built-in Ethernet Port

    In this example, the CPU series used is RCPU, the model is R00, the power module is R61P, and the base unit is R33B.

  • An IPC and a computer

  • USB Type A male to USB Mini-B male cable (used to download PLC programs)

  • Ethernet cable (used to connect the IPC and the PLC)

Software

Software Description Installed location

GX Works3 1.081K

Mitsubishi PLC programming software

Computer that is used for PLC sequence programming

Mech-Vision and Mech-Viz

Mech-Mind Vision System

IPC

In addition to the above software, please copy the iQ-R_SLMP.usl file (used to implement the features of various interface functions) to a computer that has with GX Works3 installed. The example program file can be found by using the Communication Component/Robot_Interface/Mitsubishi MC path in the folder where Mech-Vision and Mech-Viz are installed.

The firewall on the IPC or computer must be turned off.

Create and Configure the PLC Project

Create a PLC Project

  1. Open GX Works3, click the New icon in the toolbar. In the New dialog box, select RCPU for Series, R00 for Type, and Ladder for Program Language, and then click OK.

    iq r 1
  2. In the dialog box that appears, click Settings Change.

    iq r 2
  3. In the dialog box that appears, select Yes for Use Module Label in the Operation Setting section and then click OK. Return to the previous dialog box and click OK.

    iq r 3
  4. Go to Connection Destination  Current Connection Destination on the left and then double-click Connection.

    iq r 4
  5. In the Specify Connection Destination Connection dialog box, complete the following configurations.

    1. Select Serial USB in the PC side section, select PLC Module in the PLC side section, confirm that the CPU type is RCPU, and then click CPU Module Direct Coupled Setting.

    2. Select USB in the pop-up dialog box and click Yes.

    3. Return to the Specify Connection Destination Connection dialog box and click Connection Test. If the connection between GX Works3 and the PLC is established successfully, the Successfully connected with the R00CPU message will appear.

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

      iq r 5
  6. In the left-side navigation pane of the main interface of GX Works3, perform the following operations.

    1. Navigate to Parameter and double-click System Parameter.

    2. In the System Parameter dialog box, click the I/O Assignment tab, select Base/Power/Extension Cable Setting, and then click ... next to Base No.  Main.

    3. In the Model Name Selection dialog box, select the base module and power supply model based on actual situation and then click OK. In this example, R33B and R61P are selected.

      iq r 6
    4. In the following dialog box, click OK. Return to System Parameter dialog box and click OK.

      iq r 7

Configure SLMP Communication Parameters

  1. Go to Navigation  Project  Parameter  R00CPU, double-click Module Parameter.

    iq r 8
  2. In the R00CPU Module Parameter dialog box, click Basic Settings.

    1. In the IP Address section, specify the IP address settings of the PLC. In this example, the IP address is 192.168.1.22, the subnet mask is 255.255.255.0, and the default gateway is 192.168.1.0. The IP address of the PLC and that of the IPC must reside in the same subnet.

    2. Select Enable for Communication by Network No./Station No., select Not Use IP Address for Setting Method, and then set Network No. and Station No. to 1.

    3. Set Enable/Disable Online Change to Enable All (SLMP).

    4. Set Communication Data Code to Binary.

    5. Click ... next to External Device Configuration  Detailed Setting. The Ethernet Configuration (Built-in Ethernet Port) dialog box will appear.

      iq r 9

      In the Module List section on the right, select Ethernet Selection  Ethernet Device, drag SLMP Connection Module to Host Station, set the parameters in the first line based on the following figure, and then click Close with Reflecting the Setting. Return to the R00CPU Module Parameter dialog box, click Apply, and then return to the main interface of GX Works3.

      iq r 10

Import Example Programs

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

    iq r 11

    In the dialog box where “Register user library to the list” is displayed, click OK.

    iq r 12
  2. In the Register Library to Library List dialog box, find the iQ-R_SLMP.usl file (which needs to be copied from the IPC in advance) and click Open.

    iq r 13
  3. In the Element Selection section on the right of the main interface of GX Works3, click the Library tab, select User Library  IQ-R_SLMP  Program  CameraTest, and then right-click to select Add to Project  Scan.

    iq r 14
  4. In the dialog box that asks whether to overwrite data, click Yes, and then return to the main interface of GX Works3.

    iq r 15
  5. In the Navigation section, check to make sure that the programs, function blocks, and labels in the Project section are imported. Select Convert  Rebuild All in the menu bar. The Rebuild All dialog box will appear.

    iq r 16
  6. In the Rebuild All dialog box, perform the following operations.

    1. Click Options. The Options dialog box will appear.

    2. Go to Convert  Basic Setting, set Reassign Labels in Executing Rebuild All to Yes, and then click OK.

    3. Return to the Rebuild All dialog box and click OK.

      iq r 17

Download Communication Configuration and Example Programs to PLC

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

    iq r 18
  2. In the Online Data Operation dialog box, select Write  Parameter + Program(F)  Execute.

    iq r 19
  3. In the dialog box that asks whether to write and provides precautions, click Yes.

    iq r 20
  4. If the safety can be ensured, select Yes.

    iq r 21
  5. In the dialog box that asks whether to overwrite system parameters, click Yes.

    iq r 22
  6. After the download is successful, the dialog box that asks whether to execute remote run will appear. If the safety can be ensured, select Yes.

    iq r 23
  7. In the Completed dialog box, click Yes after ensuring the safety. Go back to the Online Data Operation dialog box and click Close. The settings will take effect after the PLC is powered off and then powered on.

    iq r 24

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, Mitsubishi MC Client for Protocol, and 3E for Frame. Users can set Register(D) Base Address according to actual needs. The value is set to 10000 in this example. In addition, the MM_Interface structure occupies 728 D Registers in total.

    3. In the PLC IP address text box, enter the IP address and port number of the specific PLC in use.

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

    5. Click Apply.

      mitsubishi mc
  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

Check Communication

  1. In the Navigation section, go to Program  Scan  CameraTest, and then double-click ProgramBody.

    iq r 25
  2. Select Online  Monitor  Start Monitoring (All Windows) in the menu bar.

    iq r 26
  3. In the Watch1 dialog box, add and expand the MM_Camera. If the connection is established successfully, the value of Heartbeat will keep changing.

    iq r 27
  4. The PLC is successfully connected if the following message is displayed in the Console tab of Mech-Vision Log panel: Connect to Melsec PLC successfully.

    If you don’t see this log message, please check if:

    1. The hardware network connection is normal.

    2. The Robot Communication Configuration option on the toolbar of Mech-Vision is enabled.

    3. The PLC program is 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 run and obtain the vision result and trigger the Mech-Viz project to run and obtain the planned path.

Preparations

  1. Create a Mech-Vision solution. In the Project List section of Mech-Vision, right-click the solution and select Autoload Solution. Projects in the solution are also autoloaded. Meanwhile, the project ID will show up before each project name.

  2. Create a Mech-Viz project. Right-click the project name in the project resource panel in 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

Get Vision Result from Mech-Vision

Set Parameters

  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. Then, Mech-Vision will return all vision points.

  3. Set the value of to 0. Then, the image-capturing pose does not need to be sent to the Mech-Vision project. For example, the image-capturing pose does not need to be sent when the camera is mounted in eye-to-hand mode.

    iq r 28

Run the Mech-Vision Project

  1. Right-click the input-side Camera_User.Start_Vis of the MM_Start_Vis function block, select Debug  Modify Value, change the value of Camera_User.Start_Vis to 1 to trigger the Mech-Vision project to run, and then change the value of Camera_User.Start_Vis to 0.

    iq r 29
  2. In the Watch 1 dialog box, if the Mech-Vision project has been successfully triggered, 1102 is displayed for Status_Code.

    iq r 30
    If 10XX is displayed for Status_Code and you want to troubleshoot the issue, see Status Codes and Troubleshooting.

Get Vision Result from Mech-Vision

  1. Right-click the input-side Camera_User.Get_VisData of the MM_Get_VisData function block, change the value of Camera_User.Get_VisData to 1 to obtain the vision result, and then change the value of Camera_User.Get_VisData to 0.

    iq r 31
  2. In the Watch 1 dialog box, if the vison result has been successfully obtained, 1100 is displayed for Status_Code.

    iq r 32
    If 10XX is displayed for Status_Code and you want to troubleshoot the issue, see Status Codes and Troubleshooting.

    Check the values of Target_Pose. The values indicate the pose data of vision points.

    iq r 33

Obtain Planned Path from Mech-Viz

Set Parameters

  1. Right-click the input-side Camera_User.Start_Empty of the MM_Get_VisData function block, change the value of Camera_User.Start_Empty to 1 to clear the previously obtained vision result, and then change the value of Camera_User.Start_Empty to 0.

    iq r 34

    In the Watch 1 dialog box, all values of Target_Pose are 0.

    iq r 35
  2. Set the values of Branch_Name and Branch_Exit_Port both to 1 to indicate that the project takes port No.1 of the Branch by Msg No.1 Step of the Mech-Viz project.

    iq r 36
  3. Set the value of Request_Pose_Type to 1 to indicate that the waypoints planned by Mech-Viz will be returned in joint positions.

    iq r 37

Run Mech-Viz Project

  1. Right-click the input-side Camera_User.Start_Viz of the MM_Start_Viz function block, change the value of Camera_User.Start_Viz to 1 to trigger the Mech-Viz project to run, and then change the value of Camera_User.Start_Viz to 0.

    iq r 38
  2. In the Watch 1 dialog box, if the Mech-Viz project has been successfully triggered, 2103 is displayed for Status_Code.

    iq r 39
    If 20XX is displayed for Status_Code and you want to troubleshoot the issue, see Status Codes and Troubleshooting.

Set the Exit Port for the Branch by Msg Step in Mech-Viz

  1. Right-click the input-side Camera_User.Set_Branch of the MM_Set_Branch function block, change the value of Camera_User.Set_Branch to 1 to set the exit port of the Branch by Msg Step in the Mech-Viz project, and then change the value of Camera_User.Set_Branch to 0.

    iq r 40
  2. In the Watch 1 dialog box, if the exit port has been successfully set for the Branch by Msg Step in Mech-Viz, 2105 is displayed for Status_Code.

    iq r 41
    If 20XX is displayed for Status_Code and you want to troubleshoot the issue, see Status Codes and Troubleshooting.

Get Planned Path in Mech-Viz

  1. Right-click the input-side Camera_User.Get_VizData of the MM_Get_VizData function block, change the value of Camera_User.Get_VizData to 1 to obtain the planned path from Mech-Viz, and then change the value of Camera_User.Get_VizData to 0.

    iq r 42
  2. In the Watch 1 dialog box, if the planned path has been successfully obtained, 2100 is displayed for Status_Code.

    iq r 43
    If 20XX is displayed for Status_Code and you want to troubleshoot the issue, see Status Codes and Troubleshooting.

    Check the values of Target_Pose. The values indicate the pose data of waypoints.

    iq r 44

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.