Communication Configuration and Example Program Usage

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

Hardware and Software Requirements

Hardware

  • KEYENCE PLC with a built-in Ethernet port

    In this example, the KV-8000 CPU model is used.

  • Power adapter: 220V AC to 24V DC

  • An IPC and a computer

  • USB Type A Male to Type B Male cable (used to download PLC programs)

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

Software

Software Description Installed location

KV STUDIO 11.62

KEYENCE PLC programming software

Computer that is used for KEYENCE PLC programming

Mech-Vision and Mech-Viz

Mech-Mind Vision System

IPC

In addition to the above software, please copy the example program files (used to implement the features of various interface functions) to a computer that has with KV STUDIO installed. The example program files are stored in the folder where Mech-Vision and Mech-Viz are installed: Communication Component/Robot_Interface/Mitsubishi MC/Keyence.

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

Create and Configure the PLC Project

Create a PLC Project

  1. Open the KV STUDIO software and click New project in the toolbar. In the New project dialog box, enter the project name, select KV-8000 for PLC model, click Refer to select the project path, and then click OK.

    keyence 1
  2. In the following dialog box, click Yes.

    keyence 2
  3. In the following dialog box, click No.

    keyence 3

Configure Communication Parameters of MC Protocol

  1. In the Project section, expand Unit configuration and then double-click KV-8000.

  2. In the Unit section, click Setup unit, set IP address for the PLC (such as 192.168.1.22), set MC protocol port No. (TCP) to 5000, and then click OK.

    keyence 4

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 KV STUDIO, select File  Import  Import program. The Import program dialog box will appear.

    keyence 5
  2. In the Import program dialog box, open the program folder copied from the IPC, select all files in the folder, and then click Open.

    The example program files are stored in the folder where Mech-Vision and Mech-Viz are installed: Communication Component/Robot_Interface/Mitsubishi MC/Keyence. You need to copy the Keyence folder from the IPC to the computer that has KV STUDIO installed in advance.
    keyence 6
  3. In the following dialog box, click OK.

    keyence 7

Download Communication Configuration and Example Programs to PLC

  1. In the menu bar of KV STUDIO, click the Transfer to PLC→Monitor mode icon. The Transfer program dialog box will appear.

    keyence 8
  2. In the following dialog box, keep the default settings and then click Execute.

    keyence 9
  3. During the transfer, the following dialog box will appear. Click Yes to change the PLC to the overwrite mode.

    keyence 10
  4. After the transfer is complete, the following dialog box will appear. Click Yes to change the PLC to the run mode.

    keyence 11

Set up “Robot Communication Configuration”

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

  2. In the Robot Communication Configuration dialog box, 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 section, select Standard Interface for Interface service type, Mitsubishi MC Client for Protocol, and 3E for Frame. You can set Register(D) Base Address according to actual needs. The value is set to 20000 in this example. In addition, the MM_Interface structure occupies 728 D Registers in total.

    3. In the PLC IP address field, 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.

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

    interface service

Check Communication

  1. In Monitor mode of KV STUDIO, expand items in the Project section to find CameraTest in Every-scan execution and then double-click CameraTest.

    keyence 13
  2. In the toolbar, click the registration monitor icon to open the Registration monitor dialog box, and then add MM_Camera in the dialog box.

    keyence 14
  3. In the Registration monitor dialog box, expand MM_Camera to find Heartbeat. If the connection is established successfully, the current value of Heartbeat will keep changing.

    keyence 15
  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 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

Parameter Settings

In the CameraTest program dialog box, complete the following configurations.

  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.

    keyence 16

Run the Mech-Vision Project

  1. Right-click Camera_User.Step_Num to change its value. In the dialog box that appears, change the current value of Camera_User.Step_Num to 2 to enable MM_Start_Vis.

    keyence 17
  2. Double-click the input variable CameraUser.Start_Vision of MM_Start_Vis to set CameraUser.Start_Vision to 1 to trigger the Mech-Vision project to run. Then, double-click CameraUser.Start_Vision to reset CameraUser.Start_Vision to 0.

    keyence 18
  3. In the Registration monitor dialog box, if the Mech-Vision project has been successfully triggered, 1102 is displayed for Status_Code.

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

Get Vision Result from Mech-Vision

  1. In the Correct device value dialog box, change the current value of Camera_User.Step_Num to 4 to enable MM_Get_VisData.

    keyence 20
  2. Double-click the input variable CameraUser.Get_VisData of MM_Get_VisData to set CameraUser.Get_VisData to 1 to obtain the vison result. Then, double-click CameraUser.Get_VisData to reset CameraUser.Get_VisData to 0.

    keyence 21
  3. In the Registration monitor dialog box, if the vison result has been successfully obtained, 1100 is displayed for Status_Code. Check the values of Target_Pose. The values indicate the pose data of vision points.

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

Obtain Planned Path from Mech-Viz

Set Parameters

  1. In the Correct device value dialog box, change the current value of Camera_User.Step_Num to 12 to enable MM_Empty_Target.

    keyence 23
  2. Double-click the input variable CameraUser.Start_Empty of MM_Empty_Target to set CameraUser.Start_Empty to 1 to clear the obtained vision result. Then, double-click CameraUser.Start_Vision to reset CameraUser.Start_Vision to 0.

    keyence 24

    In the Registration monitor dialog box, all values of Target_Pose are 0.

    keyence 25
  3. 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.

    keyence 26
  4. Set the value of Request_Pose_Type to 1 to indicate that the waypoints planned by Mech-Viz will be returned in joint positions.

    keyence 27

Run Mech-Viz Project

  1. In the Correct device value dialog box, change the current value of Camera_User.Step_Num to 16 to enable MM_Start_Viz.

    keyence 28
  2. Double-click the input variable CameraUser.Start_Viz of MM_Start_Viz to set CameraUser.Start_Viz to 1 to trigger the Mech-Viz project to run. Then, double-click CameraUser.Start_Viz to reset CameraUser.Start_Viz to 0.

    keyence 29
  3. In the Registration monitor dialog box, if the Mech-Viz project has been successfully triggered, 2103 is displayed for Status_Code.

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

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

  1. In the Correct device value dialog box, change the current value of Camera_User.Step_Num to 22 to enable MM_Set_Branch.

    keyence 31
  2. Double-click the input variable CameraUser.Set_Branch of MM_Set_Branch to set CameraUser.Set_Branch to 1 to set the exit port of the Branch by Msg Step in the Mech-Viz project. Then, double-click CameraUser.Set_Branch to reset CameraUser.Set_Branch to 0.

    keyence 32
  3. In the Registration monitor 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.

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

Get Planned Path in Mech-Viz

  1. In the Correct device value dialog box, change the current value of Camera_User.Step_Num to 24 to enable MM_Get_VizData.

    keyence 34
  2. Double-click the input variable CameraUser.Get_VizData of MM_Get_VizData to set CameraUser.Get_VizData to 1 to obtain the planned path from Mech-Viz. Then, double-click CameraUser.Get_VizData to reset CameraUser.Get_VizData to 0.

    keyence 35
  3. In the Registration monitor dialog box, if the planned path has been successfully obtained, 2100 is displayed for Status_Code. Check the values of Target_Pose. The values indicate the pose data of waypoints.

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

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.