Unclear instructions for writing to multiple modbus registers

The instructions for writing to multiple modbus registers at https://wiki.teltonika-networks.com/view/Modbus_TCP_Master_MQTT_Gateway are unclear.

The instruction is:
If function is 16 - from 1 to 123 (first register + registry value can not go out of range), Registry values separated by commas without spaces. Example.: 1,2,3,654,21,789 . There has to be as many values, as specified number of registers, and each value must be between 0 and 65535 . If number of registries is 0, there should be no registry values

Unclear is what is meant by “from 1 to 123”. It appears that it has to do with “specified number of registers”, but what part of the example 1,2,3,654,21,789 is the 'specified number of registers?

I’m trying to write a device name to register 72.

To anwer my own question: the instructions for writing to multiple modbus registers with function 16 are incomplete, the ‘number of registers’ is missing in the format discussed on (among others) https://wiki.teltonika-networks.com/view/Modbus_TCP_Master_MQTT_Gateway.

The correct instruction for the format is:

  1. Format version, for example 0|
  2. Cookie, for example 65432
  3. IP Type, for example 0 for IPv4
  4. IP, for example 127.0.0.1 (when ip format is 0)
  5. Port|, for example 502
  6. Timeout in seconds, 5
  7. Slave ID, 1 to 255
  8. Function, 16 - write multiple registers|
  9. Number of the first register from which information will be read or written, for example 72 for device name
  10. Number of registers to write, for example 6
  11. Registry values, for example 21077,21554,13361,30320,28271,28160

Full example: 0 65432 0 127.0.0.1 502 5 1 16 72 6 21077,21554,13361,30320,28271,28160

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