Universal Robots Forum

Single shot modbus request

I want to send command to a motor drive with modbus TCP.
The drive do not implement the “write single register (FC03)” command, only the “write multiple registers (FC16)”. For that reason I must use the “modbus_send_custom_command” script function. At runtime, the modbus request is add to a buffer and send continuously. Trying to modify the registers values with a new modbus command just add a new modbus request to the buffer but the previous command is still send. Also their is no return value with this function.

My feature request is to have a parameter to “modbus_send_custom_command” to send a single request and have a return value to know if the request was sucessful.



modbus_send_custom_command to write a single register wtihout getting back the response.

Urscript manual page 43.


@frederic.chaxel The point is that “modbus_send_custom_command” do not sends a single request, it sends continuously the request. If you call “modbus_send_custom_command” with a new data value, you will have 2 requests to write on the same registers with different values.


i think it should work with implementing a socket connection on port 502 as a workaround?

@m.birkholz Yes I could use socket, but as a feature request I would prefere to have a “modbus_send_custom_command” with single shot action. modbus_send_custom_command can’t be use to synchronise a variable with a device register, so I can’t see why the modbus request is place in a buffer and send continuously ? It make it impossible to modify the register’s value several times. To stop sending the modbus request after you call “modbus_send_custom_command” you need to reboot the robot, stopping the robot program does not works.


is there any solution or woraround to this? I have the same problem: I need to use FC16 Modbus function to communicate with the drive. In order to do this, I’m using the modbus_send_custom_command script function, but it continously send all the previous values written to it. I’m trying to position the external motor using this communication, and this problem makes it impossible task :frowning: