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.
@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.
@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.
Hello,
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
If you set the frequency to zero Hz in the installation node (installation->fieldbus->modbus), you will have a single request everytime you change the value