Universal Robots Forum

UR Robot as Modbus Client

Hello,

I am trying to communicate the UR robot with an Omron NJ series PLC using the UR robot as the modbus client.

I can read values from the holding registers and coils of the PLC but I can not send any registers or coils to it.

I followed the steps in this article: https://www.universal-robots.com/articles/ur/modbus-tcp-client-setup/

The article is talking about register IDs. I couldn’t find the register IDs of the PLC I am using.

Normally, the PLC I use does not have modbus feature but I am using a modbus library which was developed using socket communication feature of the PLC and the datasheet of the library doesn’t include a register table like the one in this article.

I typed “0” in the register ID textfield when I was trying to read from the PLC and it worked.

But it didn’t work when I typed “0” or “30001” when I was trying to write to the holding register of the PLC.

I tried my own URCAP using this command to add a modbus signal: modbus_add_signal(IP, slave_number, signal_address, signal_type, signal_name, sequential_mode=False) Again, I was successful at reading the values from the PLC but couldn’t write to it.

Also, I can write to the holding registers of the PLC using C# code that I wrote via my PC.

In the C# code, I specify the registers like from the register 0 to 20. Then it writes the data I sent to all those register.

What should the register ID be? I reckon the signal address and the register ID are the same thing here? If not what should the signal adress be as well?

Thank you,

MB

Hi @mehmet_bilgin_1905

The article states "For most devices under Modbus TCP the slave ID is not used and if that is the
case then it is set to 255" So I will suggest you set it to 255.

Ebbe

Hello,

I had already set the slave ID (slave number) to 255 as it was instructed in the urscript manual.

I am wondering what the signal address should be?

modbus_add_signal(IP, slave_number = 255, signal_address, signal_type, signal_name, sequential_mode=False)

And also are the address (marked below) and the signal address the same thing?

Thank you,

MB

Hi @mehmet_bilgin_1905,

The addresses you have marked in Polyscope, is what Polyscope uses for the signal_address in URScript. It is the register on you PLC that you need to specify here. A nice approach is to connect to local host on IP address “127.0.0.1” and add a Register Output signal with address 1. Then you will see that it maps to the outputs of the robot and you can modify them by writing a bit pattern in the value field.

Ebbe

2 Likes

Hello,

Thanks for the help Ebbe,

MB

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.