Famous_Fella

NX1P2- explicit messaging to FANUC Robot

31 posts in this topic

Hello,

I am a beginner in PLC world trying to find my way through LADDER programming, ST, protocols etc etc and I am slowly getting the hang on it but now I have come accross a troublesome implementation. We have 3 Robotic Cells in my plant each of them consisting of a Fanuc robot communicating via Ethernet IP protocol to NX1P2 PLC controller. The setup of communications is implemented and working as intended but I want to use explicit messaging to manipulate certain Robot Position Registers, Registers and string Registers. I have the needed Fanuc documentation and Omron documentation but I am a little lost. Are there any guidelines I could use to start ?

Share this post


Link to post
Share on other sites

NX1P2 supports either Class 3 or UCMM explicit messages.  Which you use will be dependent upon preference and upon the Fanuc capabilities.  It's a very simple process, there are function blocks in the CPU to read and write.

CIPRead, CIPWrite for Class 3

CIPUCMMRead and CIPUCMMWrite for UCMM obviously

UCMM does not require a connection first, it will just send a message.  Class 3 has a function block to establish the connection (pick up the phone and say hello) and then terminate the connection (goodbye and hang up) at the end.

Share this post


Link to post
Share on other sites
On 13/3/2020 at 3:04 PM, Crossbow said:

NX1P2 supports either Class 3 or UCMM explicit messages.  Which you use will be dependent upon preference and upon the Fanuc capabilities.  It's a very simple process, there are function blocks in the CPU to read and write.

CIPRead, CIPWrite for Class 3

CIPUCMMRead and CIPUCMMWrite for UCMM obviously

UCMM does not require a connection first, it will just send a message.  Class 3 has a function block to establish the connection (pick up the phone and say hello) and then terminate the connection (goodbye and hang up) at the end.

Thank you very much for your reply. I have read the instruction manual showcasing the Communication commands that you descrbied but I do not know the difference between UCMM and class 3 messages. Can you please confirm the following assumptions ?
1) CIPRead/UCMMRead is used to read a variable of another PLC connected in the same ethernetIP network. Not needed for my case.

2)CIPWrite/UCMMWrite same as above but for writing a variable.

3)CIPSend instruction sends a class 3 CIP message to a specified device on a CIP network. Meaning my robot too in my case.

what's the difference between the two ? which one would my robot controller respond to ? Would you advice using both ?

Share this post


Link to post
Share on other sites

The difference is described in this document:

https://www.odva.org/Portals/0/Library/Publications_Numbered/PUB00138R6_Tech-Series-EtherNetIP.pdf

Connected vs. Unconnected (UCMM), top of page 6.  UCMM is easier in the Sysmac Contollers, use CIPUCMMSend unless you really need to use (CIPSend, and therefore CIPOpen and CIPClose).

Share this post


Link to post
Share on other sites
1 hour ago, Michael Walsh said:

The difference is described in this document:

https://www.odva.org/Portals/0/Library/Publications_Numbered/PUB00138R6_Tech-Series-EtherNetIP.pdf

Connected vs. Unconnected (UCMM), top of page 6.  UCMM is easier in the Sysmac Contollers, use CIPUCMMSend unless you really need to use (CIPSend, and therefore CIPOpen and CIPClose).

I appreciate your help a lot. I am starting to get the hang on it. As the manual states: "The robot controller is an explicit message server and supports connected and unconnected explicit
messaging." So that means both message types can do my job.

Please let me describe what I am trying to do. Any help will be more than welcome. What I want to do is use an explicit message to manipulate a numeric register of the robot. With the FANUC documentation on hand I managed to find the instance attribute and service I need in order to accomplish that.

Write value integer 15 to Numeric Register R[15]
Class 0x6B (it is the FANUC class for integer Register manipulation)
Instance 0x01 (only 1 instance is supported)
Attribute 0x15 (in the instance no. 1 each attribute represents 1 numeric register)
Service 0x10 (Set_Attribute_Single Service)
Value 15

can you help on the below ST? Unfortunately FANUC documentation states the service class and instance codes in HEX and I dont know how to declare them

 

ReqPath is _sREQUEST_PATH Data Type with initial value of (ClassID:=0, InstanceID:=0, isAttributeID:=False, AttributeID:=0)

ReqPath.ClassID :=???;
ReqPath.InstanceID :=???;
ReqPath.isAttributeID:=???;
ReqPath.AttributeID :=???;
CIPUCMMSend_instance(
Execute :=TRUE,
RoutePath :='02\192.168.150.25',    //robot_ip
TimeOut :=UINT#20,
ServiceCode :=???,
RqPath :=ReqPath,
ServiceDat := ???,
Size :=UINT#0,
RespServiceDat:=ResDat);

 

Thank you in advance.

 

Edited by Famous_Fella

Share this post


Link to post
Share on other sites
30 minutes ago, Famous_Fella said:

ReqPath.ClassID :=UINT#16#6B;
ReqPath.InstanceID :=UINT#1; //1 is the same whether hex or decimal
ReqPath.isAttributeID:=TRUE;
ReqPath.AttributeID :=UINT#16#15;
CIPUCMMSend_instance(
Execute :=TRUE,
RoutePath :='02\192.168.150.25',    //robot_ip
TimeOut :=UINT#20,
ServiceCode :=BYTE#16#10,
RqPath :=ReqPath,
ServiceDat := ServiceDataVariable, //Create a variable that is of the type that the data to write is. If 15 value is a UINT, make this a UINT and put 15 in it.
Size :=UINT#1, //if only writing one value (15) then set this to 1.
RespServiceDat:=ResDat);

I have filled in what I think it will be.  Not sure if the attribute is hex or not, I am treating it as if it is.  If it is not, just use UINT#15.

Share this post


Link to post
Share on other sites
15 hours ago, Michael Walsh said:

I have filled in what I think it will be.  Not sure if the attribute is hex or not, I am treating it as if it is.  If it is not, just use UINT#15.

I am in your dept ! :)

Share this post


Link to post
Share on other sites
18 hours ago, Michael Walsh said:

I have filled in what I think it will be.  Not sure if the attribute is hex or not, I am treating it as if it is.  If it is not, just use UINT#15.

One more question:
Is there a way to capture the response from the robot if something doesnt go as expected?

I suppose this is done with RespServiceDat:=ResDat and after I run the command any response from the robot (server) will be recorded there, correct ? How can I monitor this variable in real time inside sysmac studio ?

Share this post


Link to post
Share on other sites
19 hours ago, Michael Walsh said:

I have filled in what I think it will be.  Not sure if the attribute is hex or not, I am treating it as if it is.  If it is not, just use UINT#15.

Also one more question: My Robot's IP is 192.168.150.25. Why do I have to use 02\ before the IP ? I originaly extracted this from the W502 Omron Instruction manual

Share this post


Link to post
Share on other sites

The 02 is just the designation for the EtherNet/IP Port.  On controllers that have 2 ports like the NX102 and NX7, the port designations are odd and are done this way:

Port 1:

'02\192.168.150.25'

Port 2:

'01\#01\02\192.168.150.25' 

Note:  01 is the port and the #01\02 is routing from one processor to the other.  NX102 is a dual core and NX7 is a quad core.

I just posted both of these because I know that someone will ask it at some point.  Just putting it out there.

Share this post


Link to post
Share on other sites
3 hours ago, Famous_Fella said:

One more question:
Is there a way to capture the response from the robot if something doesnt go as expected?

I suppose this is done with RespServiceDat:=ResDat and after I run the command any response from the robot (server) will be recorded there, correct ? How can I monitor this variable in real time inside sysmac studio ?

Yes, monitor your response data for an error response from the robot (use the Watch Tab Page as discussed below to monitor).

If something goes wrong with communications to the robot (setup incorrect, or some other issue, command does not get to robot or response does not get back), it is necessary to monitor the outputs of the function block.  Assign variables to the output pins (as shown below):

UCMMSend.jpg.3890bb8d65fe717038e7a382acc

You could just monitor the values right there in the ladder, or open the Watch Tab page:

watchtabmenu.jpg.6b3610def1fc9dbceac6366

and the window will be at the bottom of the screen.  Just add the variables to the window.  Be sure to enter local variables like this:  ProgramName.Variable Name.  You could also use this window to monitor your Response data.

Share this post


Link to post
Share on other sites
19 hours ago, Michael Walsh said:

Yes, monitor your response data for an error response from the robot (use the Watch Tab Page as discussed below to monitor).

If something goes wrong with communications to the robot (setup incorrect, or some other issue, command does not get to robot or response does not get back), it is necessary to monitor the outputs of the function block.  Assign variables to the output pins (as shown below):

UCMMSend.jpg.3890bb8d65fe717038e7a382acc

You could just monitor the values right there in the ladder, or open the Watch Tab page:

watchtabmenu.jpg.6b3610def1fc9dbceac6366

and the window will be at the bottom of the screen.  Just add the variables to the window.  Be sure to enter local variables like this:  ProgramName.Variable Name.  You could also use this window to monitor your Response data.

UPDATE:

Thank you for your valuable help. I was able to to find the error but I dont really know how to overcome this. As the manual states any errors concerning the outcome of the function will be stored in ErrorIDEx variable which in my case returns 0900 0000 Invalid attribute value but there is also another variable called ErrorID which stores 1C00 which I guess I have to ignore for now,  as the cause of my failed message is the attribute value which I don't understand why as I have followed all the rules provided by FANUC's EIP Manual and vendor-specific list of services attributes etc etc

 

Share this post


Link to post
Share on other sites

1C00 means that the ErrorIDEx will be a code that is stored there based on the remote node (that is the Fanuc Robot).  If you have looked in the Fanuc Manual and it said invalid Attribute, which is what I think you are saying, then try UINT#15 (as I mentioned in my initial response, I was unsure if the 15 was hex or decimal).  I provided the hex example above (UINT#16#15), so again, try UINT#15 (integer) for the attribute.

Share this post


Link to post
Share on other sites
1 hour ago, Michael Walsh said:

1C00 means that the ErrorIDEx will be a code that is stored there based on the remote node (that is the Fanuc Robot).  If you have looked in the Fanuc Manual and it said invalid Attribute, which is what I think you are saying, then try UINT#15 (as I mentioned in my initial response, I was unsure if the 15 was hex or decimal).  I provided the hex example above (UINT#16#15), so again, try UINT#15 (integer) for the attribute.

1 hour ago, Michael Walsh said:

1C00 means that the ErrorIDEx will be a code that is stored there based on the remote node (that is the Fanuc Robot).  If you have looked in the Fanuc Manual and it said invalid Attribute, which is what I think you are saying, then try UINT#15 (as I mentioned in my initial response, I was unsure if the 15 was hex or decimal).  I provided the hex example above (UINT#16#15), so again, try UINT#15 (integer) for the attribute.

No. In translated the error based on the table of errors provided in NJ/NX-series CPU Unit Built-in EtherNet/IP Port User’s Manual (W506). Based on FANUC documentation the errors returned can be Undefined Attribute (0x14) Returned when the Register requested does not exist. Unsupported Service (0x08) Returned when the requested service is unsupported. Undefined Class Instance (0x05) Returned when the requested instance number is unsupported. No 09. Now I also made some tests. The robot controller supports 250 Numeric Registers INT or REAL data type based on the value I send. In the attached photos I am using Class 0x6B Instance 0x01 Attribute 0x95 Service 0x10 Value 1000 to  Register R[144] = 1000.

I changed InstanceID to 2 which is unsupported and the system returned 05 fault as expected and documented from fanuc.

I then changed Attribute to a number outside the supported range of 0-250 and The message was sent (nothing changed in the controller registers though)

with all the parameters correct though I still get 09 error which is not documented by fanuc.

Share this post


Link to post
Share on other sites

Try a read first.  Use all of this below, but Byte#16#0E for the service code:

ReqPath.ClassID :=UINT#16#6B;
ReqPath.InstanceID :=UINT#1; //1 is the same whether hex or decimal
ReqPath.isAttributeID:=TRUE;
ReqPath.AttributeID :=UINT#16#15;
CIPUCMMSend_instance(
Execute :=TRUE,
RoutePath :='02\192.168.150.25',    //robot_ip
TimeOut :=UINT#20,
ServiceCode :=BYTE#16#10,
RqPath :=ReqPath,
ServiceDat := ServiceDataVariable, //Create a variable that is of the type that the data to write is. If 15 value is a UINT, make this a UINT and put 15 in it.
Size :=UINT#1, //if only writing one value (15) then set this to 1.
RespServiceDat:=ResDat);

 

See if you get data in the ResDat.

Share this post


Link to post
Share on other sites
55 minutes ago, Michael Walsh said:

Try a read first.  Use all of this below, but Byte#16#0E for the service code:

ReqPath.ClassID :=UINT#16#6B;
ReqPath.InstanceID :=UINT#1; //1 is the same whether hex or decimal
ReqPath.isAttributeID:=TRUE;
ReqPath.AttributeID :=UINT#16#15;
CIPUCMMSend_instance(
Execute :=TRUE,
RoutePath :='02\192.168.150.25',    //robot_ip
TimeOut :=UINT#20,
ServiceCode :=BYTE#16#10,
RqPath :=ReqPath,
ServiceDat := ServiceDataVariable, //Create a variable that is of the type that the data to write is. If 15 value is a UINT, make this a UINT and put 15 in it.
Size :=UINT#1, //if only writing one value (15) then set this to 1.
RespServiceDat:=ResDat);

 

See if you get data in the ResDat.

Yes! It reads Register 13 with value 20 !!!!!!!! 

Thanks a lot ! I am so happy ! I was starting to loose all hope.

Edited by Famous_Fella

Share this post


Link to post
Share on other sites

It seems like the problem is what I send. If I change data type of ServiceDat to DWORD the UCMMSEND function executes successfully

 

Share this post


Link to post
Share on other sites

YES !!!!! ServiceDat must be sent as DWORD ! Everything works flawlessly now !!!! Thank you very much for your help ! Greately appreciated !

 

Share this post


Link to post
Share on other sites

That is what I was thinking when I suggested doing a read, I thought the data type might be incorrect.   Nice work!

Share this post


Link to post
Share on other sites
14 hours ago, Michael Walsh said:

That is what I was thinking when I suggested doing a read, I thought the data type might be incorrect.   Nice work!

I really appreciate your time and effort! I spoke countless of hours with FANUC and OMRON and they couldn't guide me through setting it up. And when I set it up they couldn't propose any solutions to my problem. So much for "technical supports" and "customer care".

Share this post


Link to post
Share on other sites

Omron support is very good. At least here in the USA. I especially like the Levels of support they use. We can get through the simple solutions very quickly and move up a level if you have difficult problem. Although I do believe there a few members here in theses forums that supersede phone support. Probably because they work in the field along side customers.

That being said, fieldbus issues are difficult because you have multiple manufacturers involved. It's easy for one of them to blame the other and call it quits. Omron hasn't done that to me. There are others that have.

Edited by IO_Rack

Share this post


Link to post
Share on other sites

So moving on, on the project and after successfully using Explicit Message function to write a single Numeric Register I moved on to the next request which is to read a BLOCK of registers and store them to an array. Again, after following FANUC's documentation for the correct setting of the message parameters I managed to read the block of registers I needed and here comes the problem:

I need 4 separate blocks of registers to be stored in 4 separate arrays. To give you an idea of the project, the robot has 6 stations each station using a grinding wheel and for every wheel there are parameters like diameter, increment amount, skip increment/no of pieces, y dimension variance. So what seemed like a good idea was to create a structure (I called it SWheel) consisting of 4 arrays, then proceed to make a global variable of Data Type Swheel and using 4 separate messages extract each block and pass each array to the Response data recieved. My problem is this:
If I pass, for example, SWheel.yVariance to the RespServiceDat parameter of the CIPUCMMSend function the array is not populated with values.

If I pass another array created outside of structure in the global variables it gets populated as intended. Both arrays are of the same type (ARRAY[1..7] of REAL).

 

What am I missing?

Share this post


Link to post
Share on other sites

I am not sure exactly what you are saying.  Can you post pictures of the instruction that works, the one that doesn't, the structure and the variables?  (or you could just post the entire code and point to the issue, but likely would need to use some sort of box function and post a link)

Share this post


Link to post
Share on other sites

this code setup works as intended as you can see from the watch tab

91037876_1356511614532857_5859080950821945344_n.jpg

good.jpg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now