Communication Configuration and Example Program Usage
This topic introduces the commands for EtherNet/IP communication between an Omron NX/NJ Series PLC 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
If you configure the software to set up the EtherNet/IP communication, click this line to view the required hardware and hardware connection settings.
-
PLC:Omron NX1P2-1040DT1。
-
* Mech-Mind Vision System IPC.
-
Switch (or router) and Ethernet cables.
The hardware connection is as follows. Each device has a unique IP address, but all must be in the same subnet and not in use by other devices. Set the IP Address of PLC
If you use a PCI-e card to set up the EtherNet/IP communication, click this line to view the required hardware and hardware connection settings.
-
PLC:Omron NX1P2-1040DT1。
-
* HMS IXXAT INpact EIP Slave PCIe interface card installed on the IPC in Mech-Mind Vision System
-
Switch (or router) and Ethernet cables.
The hardware connection is as follows. Each device has a unique IP address, but all must be in the same subnet and not in use by other devices. IP address settings of the PLC and the PCIe interface card.
Software
If you configure the software to set up the EtherNet/IP communication, click this line to view the required software.
| Software | Description | Installed Location |
|---|---|---|
Sysmac Studio 1.54 |
OMRON PLC programming software |
Computer that is used for OMRON PLC programming |
Mech-Vision & Mech-Viz versions: 1.5.0 or above |
Software that provides the Mech-Mind Vision System |
IPC |
In addition, prepare the following files and copy them from the IPC to the computer on which Sysmac Studio is installed.
-
` EDS file name: 005A002B003A0100.EDS;
The EDS file can be found in the Communication Component/Robot_Interface/EthernetIP/EDSpath in the directory where Mech-Vision and Mech-Viz are installed. -
PLC example program files:
-
MM_OMRON_NJ_NX_Lib.slr(contains MM_XXX_XXX function blocks used to implement various interface commands); -
MM_OMRON_NJ_NX_Lib_Project.smc2(vision system manual/automatic mode sample project).The files are stored in /Robot_Interface/EthernetIP/Programming Samples/Omron Sysmac Studio NXNJ PLC EthernetIP in the installation directory where ` and are installed.
-
If you use a PCI-e card to set up the EtherNet/IP communication, click this line to view the required software.
| Software | Description | Installed Location |
|---|---|---|
Sysmac Studio 1.54 |
OMRON PLC programming software |
Computer that is used for OMRON PLC programming |
Communication card driver software |
IPC |
|
Mech-Vision & Mech-Viz versions: 1.5.0 or above |
Software that provides the Mech-Mind Vision System |
IPC |
Used for setting up the IP address of the PCIe card |
IPC |
In addition, prepare the following files and copy them from the IPC to the computer on which Sysmac Studio is installed.
-
` EDS file name: 005A002B003A0100.EDS;
The EDS file can be found in the Communication Component/Robot_Interface/EthernetIP/EDSpath in the directory where Mech-Vision and Mech-Viz are installed. -
PLC example program files:
-
MM_OMRON_NJ_NX_Lib.slr(contains MM_XXX_XXX function blocks used to implement various interface commands); -
MM_OMRON_NJ_NX_Lib_Project.smc2(vision system manual/automatic mode sample project).The files are stored in /Robot_Interface/EthernetIP/Programming Samples/Omron Sysmac Studio NXNJ PLC EthernetIP in the installation directory where ` and are installed.
-
Configure IPC and Initiate Communication
Check PCI-e Card and Driver Software
-
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.
-
Start the IPC, go to Start ‣ Device Manager and check if the driver software VCI4 INpact PCIe has been installed.
Configure Mech-Vision and Initiate Communication
-
Run Mech-Vision, then open "Robot Communication Configuration".
-
Select the required robot brand and model, then click Next..
-
Select Standard Interface for Interface Service Type.
-
Protocol: select “ETHERNET IP”. By default, keep “Automatically start the interface service when the project opens” checked, then click Apply.
-
In the Log window > Console tab, verify that “ETHERNET IP Interface Service” messages appear, and wait for the EtherNet/IP scanner (master) to establish a connection.
Configure IP address of the PCI-e Card
-
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. -
Open HMS IPconfig, click to scan and select Ixxat INpact EtherNet/IP(TM). Then uncheck Retrieve IP settings dynamically from a DHCP server and enter the IP address and subnet mask, as shown below. The IP address you set must match the IP address configured in the PLC. After completing the settings, click Apply and exit the software.
PLC Project Creation and Vision Library File Reference
Create PLC Project
-
Open Sysmac Studio, click "New Project". In the "Project Properties" window, enter the project name and select "Standard Project" for Type.
-
Select the device type, model, and version according to the actual hardware, then click Create to enter the main software window.
-
In the Multiview Explorer, expand Configuration and Setup > Controller Setup, then double-click Built-in EtherNet/IP Port Settings.
-
On the TCP/IP Settings tab, select Fixed IP, and set the IP address and subnet mask (e.g.,
192.168.1.22/255.255.255.0).The IP addresses of the PLC, the vision slave (adapter), and the network interface of the computer on which Sysmac Studio is installed must be on the same subnet. -
From the menu bar, click , set Connection Type to “Ethernet-Hub connection,” enter the PLC address in Remote IP (e.g.,
192.168.1.22), run “Ethernet Communication Test,” and confirm the test succeeds.
Import the Mech-Mind Library File
| Before you add the Mech-Mind example program to a project already in use, it is recommended to import it to a new project and test it first. In the following steps, the project created earlier is used to import and test the example program. |
-
From the menu bar, click to open the Library Index window.
-
Click the “Create Index” icon, select the
MM_OMRON_NJ_NX_Lib.slrlibrary file, and add it. -
After confirming that the library appears in the index, click OK.
Create Vision Global Variable Tag
-
In the Multiview Explorer, expand Programming/Data, double-click Global Variables, then right-click in the blank area and select New.
-
Create 3 global variables, and set their data types to the corresponding structures in
MM_OMRON_NJ_NX_Lib.slr. -
Set the Network Publish attribute:
-
Set
FromCamera1to "Input"; -
Set
ToCamera1to "Output"; -
Set
Camera_User1to "Not Published".
-
Built-in EtherNet/IP Port Settings and Download
Tag Set Registration
-
From the menu bar, click to open the EtherNet/IP Device List window.
-
Double-click the PLC device (e.g.,
192.168.1.22) to open EtherNet/IP Connection Settings. -
In the Tag Sets tab, click "Register All." When the "Tag Set Registration Settings" window appears, click "Register".
Install EDS File and Configure Communication
-
In the "EtherNet/IP Connection Settings" window, click the "Connection" icon on the left, then on the Connection tab click "Show EDS Library".
-
In the "EDS Library" window, click "Install", select
005A002B003A0100.EDS, and complete the installation. -
Return to the “EtherNet/IP Connection Settings” window and click “Add Target Device” in the right-hand toolbox.
-
For Node Address, enter the same address as in HMS IPconfig (e.g.,
192.168.1.10). Set Model toIxxat INpact EtherNet/IP™, set Revision to1, then click Add. -
At the bottom of the connection list, click Add, then select the newly added target device
192.168.1.10 Ixxat INpact EtherNet/IP™ Rev.1. -
Fill in the communication parameters per the configuration interface and ensure no “pink alarm” indications appear.
-
After switching the project to Online mode, click "Transfer to Controller".
-
After confirming that peripheral devices are safe, click Yes when prompted, and select “Execute Transfer to Controller in Run Mode”.
Dwnload the PLC Poject
-
From the menu bar, click and confirm that the project has switched to Online mode.
-
From the menu bar, click to transfer the project to the PLC.
-
In the “Transfer to Controller” dialog, click Execute, and after the safety confirmation, click Yes.
-
After the project transfer is complete, and after confirming that peripheral devices are safe, click Yes and OK prompted.
Check Communication
-
From the menu bar, click to open the "Watch (Project)" window.
-
Add the global variable
FromCamera1to the Watch window; if the connection is successful, you will see theFromCamera1.HEARTBEATvalue changing continuously. -
In the Mech-Vision Log window > Console tab, verify that the message “Connected to ETHERNET/IP controller successfully” appears.
If this log does not appear, check the following: .. Hardware network connections .. Whether the Mech-Vision interface service is enabled .. Whether the EtherNet/IP configuration on the PLC side is correct.
Test with Mech-Vision/Mech-Viz Project
This section introduces how to use the example program FB to trigger the Mech-Vision project to obtain vision points and trigger the Mech-Viz project to obtain the planned path. For detailed information on the I/O units, please refer to Command Specifications for ETHERNET/IP Communication between Omron NX/NJ PLC and Mech-Mind system.
Preparation
-
Set up Mech-Vision project and configure it to auto-load the current project.
-
Set up Mech-Viz project and configure it to auto-load the current project.
-
The Mech-Viz project used for testing must include a branch task named “1”.
Run Mech-Vision Project and Obtain Vision Points
Parameter settings
-
In the main software window, click Controller > Offline to switch the PLC project to Offline mode.
-
In the Multiview Explorer on the left, expand Programming > POUs > Programs > Program0, then double-click Section0. The Toolbox on the right will display the vision interface library function blocks referenced by the PLC.
-
Enable PLC–vision interaction in the program section (e.g., set
ToCamera1.COMM_ENABLE).In the “Section0” title bar, click “Variables.” Under the “External” tab, add the three required external variables (e.g.,
ToCamera1,FromCamera1, andCamera_User1), and ensure their data types match the structures defined in the library file. -
Set the vision project number:
VISION_PROJ_NUM=1, indicating that the Mech-Vision project with ID 1 in the Deployment settings will be run. -
Set the value of REQ_POSE_NUM to 0, which means the ` project will send all the vision points.
Use the vision system manual mode sample in MM_OMRON_NJ_NX_Lib_Project.smc2as a reference for programming.
Trigger Mech-Vision Project to Run
-
Download the PLC project and switch to Online.
-
Trigger the
MM_Start_Visinput variable (e.g., setCamera_User1.Start_VistoTrue, then set it back toFalse). -
Check the value returned by the variable
FromCamera1.STATUS_CODE1102represents that the branch was selected successfully. If it is10XX, please refer to Status Codes and Troubleshooting for troubleshooting.
Get Vision Target(s) Calculated by Mech-Vision
-
After
STATUS_CODE=1102, trigger theMM_Get_VisDatainput variable (e.g., setCamera_User1.Get_VisDatatoTrue, then set it back toFalse). -
Check whether the return value of
FromCamera1.STATUS_CODEis1100. -
SendPoseNumindicates the number of poses returned;Target_Posestores pose data (transmitted values are the actual values multiplied by 10,000).To view all data in a two-dimensional array, add variables to the Watch window one by one using array index notation.
Obtain Planned Path from Mech-Viz
Parameter settings
-
In the main software window, click Controller > Offline to switch the PLC project to Offline mode.
-
Set to clear the previous vision result (trigger
MM_Empty_Target). -
Trigger Mech-Viz Project to Run.
-
Set branch parameters:
BranchName=1,BranchPort=1. -
Set
REQ_POSE_TYPE=1to return joint angle data.Use the vision system manual mode sample in MM_OMRON_NJ_NX_Lib_Project.smc2as a reference for programming.
Trigger Mech-Viz Project to Run
-
Download the PLC project and switch to Online.
-
Set to clear the previous vision result (trigger
MM_Empty_Target). -
Run the Mech-Viz project with
MM_Start_Viz. -
Check the value returned by the variable
FromCamera1.STATUS_CODE2103represents that the branch was selected successfully. If it is20XX, please refer to Status Codes and Troubleshooting for troubleshooting.
Set Mech-Viz Branch Exit Port
-
Trigger
MM_Set_Branch(e.g., setCamera_User1.Set_BranchtoTrue, then set it back to False). -
Check whether the return value of
FromCamera1.STATUS_CODEis2105.
Obtain Planned Path from Mech-Viz
-
Trigger
MM_Get_VizData(e.g., setCamera_User1.Get_VizDatatoTrue, then set it back to False). -
Check whether the return value of
FromCamera1.STATUS_CODEis2100. -
SendPoseNumindicates the number of path points returned; the joint-angle results are stored inCamera_User1.TargetPose(transmitted values are the actual values multiplied by 10,000).