KNOT - Modbus RTU - Write Registers

write single holding register as integer:
/iot modbus transceive address=1 function=6 values=a2,a1,v2,v1
a2 - high byte of register address
a1 - low byte of register address
v2 - high byte of value
v1 - low byte of value

as hexadecimal:
/iot modbus transceive address=1 function=6 data=A2A1V2V1

set value 10 to register at address 1

/iot modbus transceive address=1 function=6 values=0,1,0,10
/iot modbus transceive address=1 function=6 data=0001000A

write multiple holding registers as integer:
/iot modbus transceive address=1 function=16 values=a2,a1,c2,c1,b,v12,v11,v22,v21…
a2 - high byte of first register address
a1 - low byte of first register address
c2 - high byte of registers count
c1 - low byte of registers count
b - count of bytes next (count of bytes in message)
v12,v11 - high and low bytes of first value
v22,v21 - high and low bytes of second value

as hexadecimal:
/iot modbus transceive address=1 function=16 data=A2A1C2C1BBV2V1V2V1

set value 10 to register at address 1 and value 20 to register at address 2

/iot modbus transceive address=1 function=16 values=0,1,0,2,4,0,10,0,20
/iot modbus transceive address=1 function=16 data=0001000204000A0014

REST API

POST http://router/rest/iot/modbus/transceive
{"address":1,"function":16,"values":"0,1,0,2,4,0,10,0,20"}

And let remind once again, this applies not only to KNOT, you can connect USB/RS485 adapter to any MikroTik with USB and install IoT package.