Communication Configuration and Example Program Usage

You are currently viewing the documentation for the latest version (2.1.2). To access a different version, click the "Switch version" button located in the upper-right corner of the page.

■ If you are not sure which version of the product you are currently using, please feel free to contact Mech-Mind Technical Support.

This section provides instructions on setting up Standard Interface communication via Modbus TCP between an Inovance H5U or EASY Series PLC (with built-in Ethernet module) and the Mech-Mind Vision System.

Hardware and Software Requirements

The models and versions listed below are tested and can be used. For other models and versions, you may refer to this guide for operation. If any issues occur, please contact Mech-Mind Technical Support.

Hardware

  • Inovance H5U or EASY Series PLC: Built-in Ethernet module

    The PLC model used in this example is EASY320.

  • Power adapter: 220V AC to 24V DC

  • An IPC and a computer

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

Software

Software Description Installed Location

AutoShop V4.8.2.4

Inovance PLC software

Computer that is used for Inovance PLC programming

Mech-Vision and Mech-Viz

Mech-Mind Vision System

IPC

Apart from the above software, copy the following example files to the computer where AutoShop is installed. The example files are stored in Communication Component/Robot_Interface/Modbus TCP/Inovance H5U&Easy in the installation directory where Mech-Vision and Mech-Viz are installed.

  • Modbus_TCP_Configuration.xls: used to establish communication via Modbus TCP/IP.

  • MM_Modbus_TCP_Interface_Program-v1.0.fe: used to implement the functions of various interface commands.

  • MM_Modbus_TCP_Interface.csv and Camera_User.csv: used to import the structures required by the example programs.

  • Variable_Table.csv: used to import the variables required by the example programs.

The firewall on the IPC must be turned off.

Configure IPC and Initiate Communication

Set IP Address of the IPC

  1. Open the Control Panel, and click View network status and tasks.

    set ip1
  2. In the “Network and Sharing Center” window, click Change adapter settings.

    set ip2
  3. In the “Network Connections” window, double-click the Ethernet interface connected to the PLC, and select Properties in the pop-up Ethernet Status window.

    set ip3
  4. In the Ethernet Properties window, select Networking in the menu bar, and double-click Internet Protocol Version 4(TCP/IPv4).

    set ip4
  5. In the Internet Protocol Version 4 (TCP/IPv4) window, select “Use the following IP address”, and set the IP address, subnet mask and default gateway (must be in the same subnet as the PLC). Then, click “OK” to save the changes.

    set ip5

Set up Robot Communication Configuration

  1. Open Mech-Vision, and you may enter different interfaces. Create a new solution according to the instructions below.

    • If you have entered the Welcome interface, click New blank solution.

      create solution 1
    • If you have entered the main interface, click File  New Solution on the menu bar.

      create solution 2
  2. Click Robot Communication Configuration on the toolbar of Mech-Vision.

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

    1. Click the Select robot dropdown, and choose either Listed robot or Custom robot according to the robot used in your project. Then click Next.

      • Listed robot: Suitable for most robots. Click Select robot model to choose the specific robot model.

      • Custom robot: Suitable for gantry robots or robots not included in the listed robot category. Robot Euler angle convention and robot coordinate system need to be selected.

    2. In the Communication mode area, select Standard Interface for Interface service type, MODBUS TCP Slave for Protocol, and CDAB for Byte order. Set the Slave ID to 255.

    3. Set the port number to 2000 for the host IP address.

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

    5. Click Apply.

      modbus tcp q series
  4. 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

Create and Configure the PLC Project

Create a PLC Project

  1. Open AutoShop, and click New Project on the toolbar. Enter the project name in the New Project window, and then select the save path. Select Ladder Chart in the drop-down menu of Editor. Click OK.

    inovance 1
  2. Click Tools  Communication Settings in the menu bar.

    inovance 2
  3. In the following window, select Ethernet for Communication type, and enter the IP address (in this example, 192.168.1.22 is used) of the PLC in the Device IP field. Click Test.

    inovance 3

    If the connection status shows Connected, it indicates that AutoShop has successfully communicated with the hardware PLC. Then click OK to return to the AutoShop software window.

    inovance 4

Configure Communication Parameters of Modbus TCP

  1. In the Project Manager panel on the left, navigate to Ethernet, right-click Ethernet, and select Add Ethernet Config.

    inovance 5
  2. In the following window, enter the IP address of the IPC in the IP Address field (it must be in the same subnet as the PLC device; in this example, 192.168.1.20 is used). Enter the service port number of the IPC in the Port Number field (it must match the host port number set in Mech-Vision; in this example, 2000 is used). Keep the other options at their default settings, and click OK.

    inovance 6
  3. Double-click the newly added Ethernet configuration to open the ModbusTcp Config window.

    inovance 7
  4. In the following window, click Import, locate and select the Modbus_TCP_Configuration.xls file, then click Open.

    The Modbus_TCP_Configuration.xls file is stored in Communication Component/Robot_Interface/Modbus TCP/Inovance H5U&Easy in the installation directory where Mech-Vision and Mech-Viz are installed. User should copy this file from the IPC to the computer where AutoShop is installed in advance.
    inovance 8

    If the file opens successfully, a pop-up message Import data successful! will appear. Finally, click OK to return to the AutoShop software window.

    inovance 9
    In the figure above, the Slave NO. should be consistent with the slave device address set in Mech-Vision. In this example, the slave register addresses (reserved) are not read.

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 Project Manager panel on the left, right-click Structure, and select New Data Structure.

    inovance 10

    In the following window, enter MM_Modbus_TCP_Interface in the Name field, and click OK. The structure table will open automatically.

    inovance 11
  2. In the MM_Modbus_TCP_Interface structure table, right-click Import.

    inovance 12

    Locate and select the MM_Modbus_TCP_Interface.csv file, and then click Open. If the file opens successfully, a pop-up message Import data successful! will appear. Finally, click OK to return to the AutoShop software window.

    The MM_Modbus_TCP_Interface.csv file is stored in Communication Component/Robot_Interface/Modbus TCP/Inovance H5U&Easy in the installation directory where Mech-Vision and Mech-Viz are installed. User should copy this file from the IPC to the computer where AutoShop is installed in advance.
    inovance 13
  3. Repeat steps 1 and 2 above to create a new structure named Camera_User and import its member variable data.

    inovance 14
  4. In the Project Manager panel, right-click Variable_Table and select Open.

    inovance 15
  5. In the variable table, right-click Import.

    inovance 16

    Locate and select the Variable_Table.csv file, then click Open.

    The Variable_Table.csv file is stored in Communication Component/Robot_Interface/Modbus TCP/Inovance H5U&Easy in the installation directory where Mech-Vision and Mech-Viz are installed. User should copy this file from the IPC to the computer where AutoShop is installed in advance.

    If the file opens successfully, a pop-up message Import data successful! will appear. The Element Addr. here should match the Mapped Addr. in the ModbusTcp Config window from the previous section. Finally, click OK to return to the AutoShop software window.

    inovance 17
  6. In the Project Manager panel, right-click Function (FC) and select Import FC. Locate and select the MM_Modbus_TCP_Interface_Program-v1.0.fe file, then click Open.

    The MM_Modbus_TCP_Interface_Program-v1.0.fe file is stored in Communication Component/Robot_Interface/Modbus TCP/Inovance H5U&Easy in the installation directory where Mech-Vision and Mech-Viz are installed. User should copy this file from the IPC to the computer where AutoShop is installed in advance.
    inovance 18

    The successfully imported function is shown in the figure below.

    inovance 19

Download Communication Configuration and Example Programs to PLC

  1. In the menu bar of the AutoShop software window, click PLC  Download.

    inovance 20
  2. In the following dialog box, keep the default settings and then click OK.

    inovance 21
  3. In the following dialog box, click OK.

    inovance 22
  4. After the project is successfully downloaded, the following dialog box will appear. Once you have verified safety, click OK.

    inovance 23

Check Communication

  1. In the AutoShop software toolbar, click the Monitoring icon. In the pop-up dialog box, click Yes.

    inovance 24
  2. In the following window, click the Monitoring tab and add the MM_Camera variable. If the connection is established successfully, the current value of Heartbeat will keep changing.

    inovance 25
  3. If the connection is successful, a message indicating a successful connection to the Modbus TCP slave will appear in the Console tab of the log panel in the Mech-Vision main window.

    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 FB 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.

Preparation

  1. Return to Mech-Vision and create a Mech-Vision project. 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

  1. In the AutoShop software toolbar, click the Online Modification icon.

    inovance 26
  2. In the Project Manager panel, double-click MAIN. In Net 1, enter the comparison command LD= Camera_User.Step_Num K2. Then apply the command MM_Start_Vis.

    inovance 27
    inovance 28
  3. Set the input and output ports of MM_Start_Vis as shown in the figure 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. Then, Mech-Vision will return all vision points.

    3. Set the value of Robot_Pose_Type 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.

    4. Add the corresponding variables to the remaining ports as shown in the figure below.

      inovance 29
  4. In Net 2, enter the comparison command LD= Camera_User.Step_Num K4. Then apply the command MM_Get_VisData.

    inovance 30
  5. Set the input and output ports of MM_Get_VisData as shown in the figure below.

    1. Set the Vision_Proj_Num port value to 1, indicating that the vision results of Mech-Vision project 1 will be retrieved.

    2. Add the corresponding variables to the remaining ports as shown in the figure below.

      inovance 31
  6. In the toolbar, click the Download icon.

    inovance 32
  7. In Information Output Window, click the Communications tab. If the download is successful, a message Download successful will be displayed here.

    inovance 33

Run the Mech-Vision Project

  1. In the AutoShop software toolbar, click the Write icon.

    inovance 34
  2. In the Write Element Value dialog box, perform the following operations:

    1. Under Word Element, select Camera_User.Step_Num for Element, set Value to 2, and click Set to enable the MM_Start_Vis function.

    2. Under Bit Element, select Camera_User.Start_Vis for Element, click Force ON to trigger the Mech-Vision project. Then, click Force OFF to reset Camera_User.Start_Vis.

      inovance 35
  3. In Information Output Window, click the Monitoring tab. If the Status_Code value is 1102, it indicates that the Mech-Vision project has been successfully triggered to run.

    If 10XX is displayed for Status_Code, refer to Status Codes and Troubleshooting for troubleshooting.
    inovance 36

Get Vision Result from Mech-Vision

  1. In the Write Element Value dialog box, perform the following operations:

    1. Under Word Element, select Camera_User.Step_Num for Element, set Value to 4, and click Set to enable the MM_Get_VisData function.

    2. Under Bit Element, select Camera_User.Get_VisData for Element, click Force ON to obtain the vision result. Then, click Force OFF to reset CameraUser.Get_VisData.

      inovance 37
  2. In Information Output Window, click the Monitoring tab. If the Status_Code value is 1100, it indicates that the vision result has been successfully obtained. Check the values of Target_Pose. The values indicate the pose data of vision points.

    If 10XX is displayed for Status_Code, refer to Status Codes and Troubleshooting for troubleshooting.
    inovance 38

Automate the Process of Getting Vision Result from Mech-Vision

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

inovance 39

Obtain Planned Path from Mech-Viz

Parameter Settings

  1. In the Project Manager panel, double-click MAIN. In Net 3, enter the comparison command LD= Camera_User.Step_Num K6. Then apply the command MM_Empty_Target.

    inovance 40
  2. Add the corresponding variables to the input and output ports of MM_Empty_Target as shown in the figure below.

    inovance 41
  3. In Net 4, enter the comparison command LD= Camera_User.Step_Num K8. Then apply the command MM_Start_Viz.

  4. In Net 5, enter the comparison command LD= Camera_User.Step_Num K10. Then apply the command MM_Set_Branch.

  5. In Net 6, enter the comparison command LD= Camera_User.Step_Num K12. Then apply the command MM_Get_VizData.

    inovance 42
  6. Set the input and output ports of MM_Start_Viz as shown in the figure below.

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

    2. Add the corresponding variables to the remaining ports as shown in the figure below.

      inovance 43
  7. Set the input and output ports of MM_Set_Branch as shown in the figure below.

    1. 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.

    2. Add the corresponding variables to the remaining ports as shown in the figure below.

      inovance 44
  8. Set the input and output ports of MM_Get_VizData as shown in the figure below.

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

    2. Add the corresponding variables to the remaining ports as shown in the figure below.

      inovance 45
  9. In the toolbar, click the Download icon.

    inovance 32
  10. In Information Output Window, click the Communications tab. If the download is successful, a message Download successful will be displayed here.

    inovance 33

Run the Mech-Viz Project

  1. In the AutoShop software toolbar, click the Write icon.

    inovance 34
  2. In the Write Element Value dialog box, perform the following operations:

    1. Under Word Element, select Camera_User.Step_Num for Element, set Value to 6, and click Set to enable the MM_Empty_Target function.

    2. Under Bit Element, select Camera_User.Start_Empty for Element, click Force ON to clear the obtained vision result. Then, click Force OFF to reset CameraUser.Start_Empty.

      inovance 46
  3. In Information Output Window, click the Monitoring tab. If the Status_Code value is 3103, it indicates that the variable values Camera_User.Target_Pose, Camera_User.Target_Label, and Camera_User.Target_Tool_ID have been successfully cleared.

    inovance 47
  4. In the Write Element Value dialog box, perform the following operations:

    1. Under Word Element, select Camera_User.Step_Num for Element, set Value to 8, and click Set to enable the MM_Start_Viz function.

    2. Under Bit Element, select Camera_User.Start_Viz for Element, click Force ON to trigger the Mech-Viz project. Then, click Force OFF to reset Camera_User.Start_Viz.

      inovance 48
  5. In Information Output Window, click the Monitoring tab. If the Status_Code value is 2103, it indicates that the Mech-Viz project has been successfully triggered to run.

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

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

  1. In the Write Element Value dialog box, perform the following operations:

    1. Under Word Element, select Camera_User.Step_Num for Element, set Value to 10, and click Set to enable the MM_Set_Branch function.

    2. Under Bit Element, select Camera_User.Set_Branch for Element, click Force ON to set the exit port of the Branch by Msg Step in Mech-Viz. Then, click Force OFF to reset CameraUser.Set_Branch.

      inovance 50
  2. In Information Output Window, click the Monitoring tab. If the Status_Code value is 2105, it indicates that the exit port has been successfully set for the Branch by Msg Step in Mech-Viz.

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

Get Planned Path in Mech-Viz

  1. In the Write Element Value dialog box, perform the following operations:

    1. Under Word Element, select Camera_User.Step_Num for Element, set Value to 12, and click Set to enable the MM_Get_VizData function.

    2. Under Bit Element, select Camera_User.Get_VizData for Element, click Force ON to obtain the planned path from Mech-Viz. Then, click Force OFF to reset CameraUser.Get_VizData.

      inovance 52
  2. In Information Output Window, click the Monitoring tab. If the Status_Code value is 2100, it indicates that the planned path has been successfully obtained. 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.
    inovance 53

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.

inovance 54
inovance 55

Is this page helpful?

You can give a feedback in any of the following ways:

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.