Communication Configuration and Example Program Usage (PLC with External QJ71E71 Ethernet Module)

This topic provides instructions on setting up the Standard Interface communication based on the MC protocol between a Mitsubishi MELSEC-Q Series PLC (with External QJ71E71 Ethernet Module) and Mech-Mind Software Suite.

Hardware and Software Requirements

Hardware

  • Mitsubishi PLC: with external QJ71E71 Ethernet interface module

    • Ethernet Module: QJ71E71-100 (example in this instruction)

    • CPU: MELSEC-Q Series Q03UDVCPU

    • QPower supply: Mitsubishi Q61P

    • Base unit: Mitsubishi Q33B

  • IPC

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

  • Network switch and Ethernet cables

The connection of the hardware system is shown below.

../../../../_images/hardware_connection9.png

Software

Software

Description

Installed Location

GX Works2

Mitsubishi PLC programming software

Computer that is used for PLC programming

Mech-Mind Software Suite 1.7.2 or above

Mech-Mind Software Suite

IPC

In addition to the above software, please copy the example program file MC MC Protocol_Q_Simple_Label_E71.GXW (used to implement the functions of various interface commands) to a PC with GX Works2 installed. The example program files are stored in the folder where Mech-Mind Software Suite is installed: Mech-Center/Robot_Interface/MITSUBISHI Melsec.

Attention

The firewall on the IPC must be turned off.

Create and Configure the PLC Project

Create a PLC Project

  1. Open GX Works2, and click the New icon on the toolbar. In the New Project window, select QCPU (Q mode) as the Series, Q03UDV as the Type, Simple Project as the Project Type. Select Use Label, and select Ladder as the Language. After setting, click OK to save changes.

    ../../../../_images/create_plc_13.png
  2. Go to Navigation ‣ Connection Destination ‣ Current Connection, and double-click Connection1.

    ../../../../_images/create_plc_23.png
  3. A Transfer Setup Connection1 window will pop up. Please follow the steps below.

    1. Select Serial USB in the PC side I/F panel, and select QCPU (Q mode) as the PLC Mode, and then click PLC Direct Coupled Setting.

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

    3. Go back to the Transfer Setup Connection1 window, and click Connection Test. If GX Works2 is connected with the PLC successfully, a message saying Successfully connected with the Q03UDVCPU will pop up.

    4. Click OK in the Transfer Setup Connection1 window and return to the main interface of GX Works2.

    ../../../../_images/create_plc_33.png

Configure Communication Parameters of MC protocol

  1. Go to Navigation ‣ Project ‣ Parameter‣ Network Parameter, and double-click Ethernet/CC IE/MELSECNET.

    ../../../../_images/external_configure_plc_1.png
  2. In the pop-up Network Parameter window, configure the network according to the specific Ethernet hardware, the figure below shows the configuration of the example in this instruction, and click Operation Setting.

    ../../../../_images/external_configure_plc_2.png
  3. In the pop-up Ethernet Operation Setting window, please follow the steps below.

    1. In the Communication Data Code area, select Binary Code.

    2. In the IP Address Setting area, set the IP Address of the Ethernet Module QJ71E71-100, for example, as 192.168.1.22 (which should be consistent with the IP address of the IPC).

    3. Select Enable Online Change.

    4. In the Initial Timing area, select Always wait for OPEN (Communication possible at STOP time).

    5. In Send Frame Setting and TCP Existence Confirmation Setting areas, please keep the default setting.

    6. Click End.

    ../../../../_images/external_configure_plc_3.png
  4. Go back to the Network Parameter window, click Open Setting. In the pop-up window, set the parameters of the first and second lines as shown in the figure below. Click End and return to the Network Parameter window. Then click End and return to the main interface of GX Works2.

    ../../../../_images/external_configure_plc_4.png

Import Example Programs

Attention

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. In the menu bar of GX Works2, go to Project ‣ Library ‣ Install.

    ../../../../_images/import_file_13.png
  2. In the pop-up Import Library to Project window, select Select Library (Project) from the Library List and click Browse to locate the local file MC Protocol_Q_Simple_Label_E71.gxw (which should be copied from the IPC in advance), and click Open.

    ../../../../_images/external_import_file_2.png
  3. In the Import Library to Project window, click Refresh FB List. Then select all items in the FB List, and click OK.

    ../../../../_images/external_import_file_3.png
  4. A message saying “Are you sure to overwrite?” will pop up. Select Yes in the window and go back to the main interface of GX Works2.

    ../../../../_images/import_file_42.png
  5. In GX Works2, go to Tool ‣ Device/Label Automatic-Assign Setting.

    ../../../../_images/import_file_51.png
  6. In the pop-up Device/Label Automatic-Assign Setting window, modify the Assignment Range of word device D, and then click OK.

    ../../../../_images/import_file_61.png
  7. Select Yes in the pop-up window as shown below and return to the main interface of GX Works2.

    ../../../../_images/import_file_71.png

Download Communication Configuration and Example Programs to PLC

  1. In GX Works2, expand the Program Setting in the Navigation, drag the MAIN under No Execution Type to Scan Program. The program structure after the adjustment is shown in the figure below. Then double-click Program under MAIN.

    ../../../../_images/download_configuration_12.png
  2. Click Rebuild All icon on the toolbar.

    ../../../../_images/download_configuration_42.png
  3. Select Yes for “Are you sure you want to Rebuild All?” in the caution window.

    ../../../../_images/download_configuration_51.png
  4. Click Write to PLC icon on the toolbar.

    ../../../../_images/download_configuration_6.png
  5. In the pop-up Online Data Operation window, select Write, click Parameter + Program, and click Execute.

    ../../../../_images/download_configuration_7.png
  6. Click Yes in the pop-up window as shown below.

    ../../../../_images/download_configuration_8.png
  7. Select Yes to all for “Are you sure you want to overwrite the existing file?”.

    ../../../../_images/download_configuration_9.png
  8. Click Close if the text box below reads “Write to PLC: Completed”.

    ../../../../_images/download_configuration_10.png
  9. A message will pop up and if the system safety can be ensured, select Yes to return to the Online Data Operation window, and click Close. Lastly, close the PLC CPU power and restart it.

../../../../_images/download_configuration_111.png

Set up “Robot and Interface Configuration” in Mech-Vision

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

  2. Select Listed robot from the Select robot drop-down menu, and then click Select robot model. Select the robot model that you use, and then click Next.

  3. Select the following options and click Apply.

    • Interface Type: Standard Interface

    • Protocol: Mitsubishi MC Client

    • PLC IP Address: Enter the IP address and port number of the specific PLC in use

    • Frame: 3E

    • Register (D) Base Address: according to your needs. A total of 728 D registers are occupied. The example in this instruction is 10000

  4. Make sure the Interface Service is started: on the toolbar of Mech-Vision, the Interface Service switch on the far right is flipped and turned to blue.

Check Communication

  1. In GX Works2, click the Start Monitoring (All Windows) icon on the toolbar.

    ../../../../_images/establish_communication_13.png
  2. Click Yes in the pop-up window as shown below.

    ../../../../_images/establish_communication_22.png
  3. In the Watch1 window, add and expand the Device MM_Camera. If the connection is established successfully, the monitor value of HEARTBEAT will keep changing.

    ../../../../_images/establish_communication_31.png
  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 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 (FB) to trigger the Mech-Vision project to obtain vision points and trigger the Mech-Viz project to obtain the planned path.

Prerequisites

  1. Create a Mech-Vision solution. In the project list, right-click the solution and select Autoload Solution. Projects in the solution are also autoloaded and the specific project number will appear in front of the project name.

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

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

    ../../../../_images/preparation_4.png

Run Mech-Vision Project and Obtain Vision Points

Open Monitor (Write Mode)

  1. In GX Works2, under the Navigation/Project, click Monitor (Write Mode) icon on the toolbar.

    ../../../../_images/test_vision_13.png
  2. Click OK in the pop-up window as shown below.

    ../../../../_images/test_vision_23.png

Add and Set the MM_Start_Vis FB

  1. Expand POU ‣ FB_Pool and drag MM_Start_Vis to line 0 of MAIN. An Input FB Instance Name window will pop up. Keep the default settings and click OK.

    ../../../../_images/test_vision_33.png
  2. Click Horizontal Line icon on the toolbar. Click OK in the pop-up window to connect the left bus line with the EN1 input port of the FB.

    ../../../../_images/test_vision_43.png
  3. Set Mech-Vision project ID: set the port value of Vision_Proj_Num to 1, and project No. 1 in Mech-Vision will be run.

  4. Set the number of vision points to be sent by Mech-Vision: set the port value of Req_Pose_Num to 0, and all poses in the vision result will be returned from Mech-Vision.

  5. Set the type of pose to be sent by the robot: setting the port 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.

  6. Double-click in the blue frame area on the left of Start_Vision port of MM_Start_Vis FB. Select Open Contact in the pop-up window, and enter the global label Camera_User.Start_Vis. Then click OK to connect the Start_Vision port with the bus line.

    ../../../../_images/test_vision_53.png
    ../../../../_images/test_vision_63.png

Add and Set the MM_Get_VisData FB

  1. Drag MM_Get_VisData to line 0 of MAIN. An Input FB Instance Name window will pop up. Keep the default settings and click OK. Click Horizontal Line icon on the toolbar, and click OK in the pop-up window to connect the left bus line with the EN1 input port of the FB.

    ../../../../_images/test_vision_73.png
  2. Set Mech-Vision project ID: set the port value of Vision_Proj_Num to 1, and project No. 1 in Mech-Vision will be run.

  3. Double-click in the blue frame area on the left of Get_VisData port of MM_Get_VisData FB. Select Open Contact in the pop-up window, and enter the global label Camera_User.Get_VisData. Then click OK to connect the Get_VisData port with the bus line.

    ../../../../_images/test_vision_82.png

Write/Convert/Compile Programs to PLC

  1. Click the Online Program Change icon on the toolbar.

    ../../../../_images/test_vision_91.png
  2. Click OK in the pop-up Confirm Build Method for Online Program Change window.

    ../../../../_images/test_vision_101.png
  3. Click Yes in the pop-up window as shown below.

    ../../../../_images/test_vision_112.png
  4. Lastly, click OK to complete downloading the program to PLC.

    ../../../../_images/test_vision_121.png

Trigger Mech-Vision Project to Run

  1. In the interface of MAIN, right-click the input variable Camera_User.Start_Vis of MM_Start_Vis FB, and select Debug ‣ Modify Value.

    ../../../../_images/test_vision_131.png
  2. In the pop-up Modify Value window, click ON to trigger Mech-Vision project to run. Then click OFF to reset the value.

    ../../../../_images/test_vision_14.png
  3. Right-click on the blank space, select Register to Watch, and enter the global label MM_Camera.Status_Code. If the project is started successfully, the status code 1102 will be returned.

    ../../../../_images/test_vision_15.png

    Attention

    If the corresponding error code is returned, please refer to Status Codes and Troubleshooting for troubleshooting.

Obtain Vision Points

  1. Select the input variable Camera_User.Get_VisData of MM_Get_VisData FB, and select Debug ‣ Modify Value in the context menu. In the pop-up Modify Value window, click ON to clear the previously obtained waypoint data. Then click OFF to reset the value.

    ../../../../_images/test_vision_16.png
  2. In the Watch1 window, enter the global label MM_Camera.Status_Code. If the vision points are obtained successfully, the status code 1100 will be returned. Then, enter the global label MM_Camera.Target_Pose, and the pose data of vision points will be returned.

    ../../../../_images/test_vision_17.png

    Attention

    If the corresponding error code is returned, please refer to Status Codes and Troubleshooting for troubleshooting.

Run Mech-Viz Project and Obtain Planned Path

Add and Set the MM_Start_Empty FB

  1. Drag MM_Start_Empty to line 54 of MAIN. An Input FB Instance Name window will pop up. Keep the default settings and click OK. Click Horizontal Line icon on the toolbar, and click OK in the pop-up window to connect the left bus line with the EN1 input port of the FB.

    ../../../../_images/test_viz_14.png
  2. Double-click in the blue frame area on the left of Start_Empty port of MM_Start_Empty FB. Select Open Contact in the pop-up window, and enter the global label Camera_User.Start_Empty. Then click OK to connect the Start_Empty port with the bus line.

    ../../../../_images/test_viz_23.png

Add and Set MM_Start_Viz, MM_Set_Branch, and MM_Get_VizData FB

  1. Drag MM_Start_Viz, MM_Set_Branch, and MM_Get_VizData to MAIN respectively. An Input FB Instance Name window will pop up. Keep the default settings and click OK. Click Horizontal Line icon on the toolbar. Click OK in the pop-up window to connect the left bus line with the EN1 input port of the FBs.

    ../../../../_images/test_viz_33.png
    ../../../../_images/test_viz_43.png
    ../../../../_images/test_viz_53.png
  2. Set the type of pose to be sent by the robot: setting the port 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.

    Double-click in the blue frame area on the left of EN1 port of MM_Start_Viz FB. Select Close Contact in the pop-up window, and enter the global label Camera_User.Get_VizData. Then, click OK to connect the EN1 port with the left bus line.

    Double-click in the blue frame area on the left of Start_Viz port of MM_Start_Viz FB. Select Open Contact in the pop-up window, and enter the global label Camera_User.Start_Viz. Then, click OK to connect the Start_Viz port with the left bus line.

    ../../../../_images/test_viz_63.png
  3. Set the branch parameters in Mech-Viz project: set the port value of Branch_Name and Branch_Exit_Port to 1 respectively, and the Mech-Viz project will take the exit port 1 for the “Branch by Msg” Step named 1.

  4. Double-click in the blue frame area on the left of Set_Branch port of MM_Set_Branch FB. Select Open Contact in the pop-up window, and enter the global label Camera_User.Set_Branch. Then click OK to connect the Set_Branch port with the left bus line.

    ../../../../_images/test_viz_73.png
  5. Set the pose type of the obtained waypoints: set the port value of Request_Pose_Type to 1, and Mech-Viz will return waypoints in JPs.

    Attention

    The Request_Pose_Type here and Robot_Pose_Type of the MM_Start_Vis and MM_Start_Viz FB all correspond to the Pose_Type variable of the global label MM_Camera. Therefore, if these parameters are set to different values, the programming should ensure that the two values do not take effect at the same time.

  6. Double-click in the blue frame area on the left of EN1 port of MM_Get_VizData FB. Select Close Contact in the pop-up window, and enter the global label Camera_User.Start_Viz. Then click OK to connect the EN1 port with the left bus line.

  7. Double-click in the blue frame area on the left of Get_VizData port of MM_Get_VizData FB. Select Open Contact in the pop-up window, and enter the global label Camera_User.Get_VizData. Then click OK to connect the Get_VizData port with the left bus line.

    ../../../../_images/test_viz_83.png

Write/Convert/Compile Programs to PLC

  1. Click the Online Program Change icon on the toolbar.

    ../../../../_images/test_viz_93.png
  2. Click OK in the pop-up Confirm Build Method for Online Program Change window.

    ../../../../_images/test_viz_102.png
  3. Click Yes in the pop-up window as shown below.

    ../../../../_images/test_viz_113.png
  4. Lastly, click OK to complete downloading the program to PLC.

    ../../../../_images/test_viz_121.png

Trigger Mech-Viz Project to Run

  1. In the interface of MAIN, right-click the input variable Camera_User.Start_Empty of MM_Start_Empty FB, and select Debug ‣ Modify Value in the context menu. In the pop-up Modify Value window, click ON to clear the previously obtained waypoint data. Then click OFF to reset the value.

    ../../../../_images/test_viz_131.png

    In the Watch1 window, enter the global label MM_Camera.Status_Code. The status code 3103 should be returned, and the variable values of Camera_User.Target Pose, Camera_User.Target Label, and Camera_User.Speed Percentage should be cleared.

    ../../../../_images/test_viz_141.png
  2. In the interface of MAIN, right-click the input variable Camera_User.Start_Viz of MM_Start_Viz FB, and select Debug ‣ Modify Value in the context menu. In the pop-up Modify Value window, click ON to trigger the Mech-Viz project to run. Then click OFF to reset the value.

    ../../../../_images/test_viz_15.png
  3. In the Watch1 window, enter the global label MM_Camera.Status_Code. If the project is started successfully, the status code 2103 will be returned.

    ../../../../_images/test_viz_16.png

    Attention

    If the corresponding error code is returned, please refer to Status Codes and Troubleshooting for troubleshooting.

Set Branch Exit Port

  1. In the interface of MAIN, right-click the input variable Camera_User.Set_Branch of MM_Set_Branch FB, and select Debug ‣ Modify Value in the context menu. In the pop-up Modify Value window, click ON to trigger the Mech-Viz project to run. Then click OFF to reset the value.

    ../../../../_images/test_viz_17.png
  2. In the Watch1 window, enter the global label MM_Camera.Status_Code. If the branch is set successfully, the status code 2105 will be returned.

    ../../../../_images/test_viz_18.png

    Attention

    If the corresponding error code is returned, please refer to Status Codes and Troubleshooting for troubleshooting.

Obtain Planned Path

  1. In the interface of MAIN, right-click the input variable Camera_User.Get_VizData of MM_Get_VizData FB, and select Debug ‣ Modify Value in the context menu. In the pop-up Modify Value window, click ON to obtain the planned path from Mech-Viz. Then click OFF to reset the value.

    ../../../../_images/test_viz_19.png
  2. In the Watch1 window, enter the global label MM_Camera.Status_Code. If the planned path is obtained successfully, the status code 2100 will be returned. Then enter the global label MM_Camera.Target_Pose, and the JPs of the waypoints in the path will be returned.

    ../../../../_images/test_viz_20.png

    Attention

    If the corresponding error code is returned, please refer to Status Codes and Troubleshooting for troubleshooting.