OMRON TM Cobot TCP communication with a NJ/NX PLC

Updated April 13, 2023

Scenario

You need to connect an Omron TM robot to a Omron NX/NJ PLC. This connection is setup using the TCP socket config, where the Cobot sends a string based message to the PLC and receives a response back.



Hardware Setup 

Both the TM controller and NX/NJ PLC need to be connected through an ethernet port. On the TM controller this is located at the point labelled 'LAN'

On the NX1P2 PLC, the ethernet cable is connected to port 1 Ethernet/IP

Delete



Solution

TM12 Setup 

  1. The first step is to setup the IP addresses on the Cobot and PLC controller. In TM flow, go to system settings and select the network icon. 
  2. Under Network settings, change the local area connection to static IP and IP address of the external network. It should be noted the  Cobot and PLC must be on the same IP address and subnet to communicate, such if the cobot is on 192.168.250.50, then the PLC will need to  have an address such as 192.168.250.10. 


  3. Add a network node interface on TM flow and Add Device


  4.  Enter the device name, IP address and port number
  5. On TM flow, add 2 network nodes, one for sending and one for receiving. In this example a SET node was also used to verify the communications is working correctly. 


  6. To send or receive information, a data string or variable will be sent. The two network nodes will be required to be set up as either a send network or receive to variable. 
  7. On completion of the program, press and hold the 'Play' button button for 2 seconds to execute the program. 
Delete

NX PLC setup

On the PLC connection side, the IP address needs to be set by opening Sysmac Studio. Navigate to Configurations and Setup> Built-in EtherNet/IP Port Settings>TCP/IP> IP. Ensure the PLC IP address in on the same subnet but a different IP address number such as 192.168.250. XXX

Delete

Creating the PLC program

To create the program, the TCP function blocks will be used, located under communications in the toolbox. 

For the PLC and Cobot to communicate using TCP, the data that will be sent and received is a Byte array that will need to be converted to type ARRAY[0..1998] OF BYTE.

The ladder program involves using the TCP function blocks in the following order to successfully communicate using a TCP socket. 

  1. To start the program, SktTCPStatus needs to be pulsed when the program is not running and the port is ready. this FB will accept the connection from clients. 
  2. SktTCPAccept will check the ports current status and if any messages are available for receiving.
  3. The data needs to be processed and monitored using the DatRcvFlag, oand set to true on the SktGetTCPStatus FB. 
  4. StkTCPSend is used to send data to the port
  5. build and upload program to PLC. Open the watch window on Sysmac and Display manager on TM flow to watch the communication occur. 

The TCP Socket is successfully working if the watch window on Sysmac diplays a message like the example below. 


Delete




Start a Conversation
This conversation is closed
Uploading...