KNOT - Modbus RTU - Write Registers
Posted: Mon Jul 15, 2024 10:40 am
Hi,
I'm pretty fine reading any kind of registers with the KNOT device via the transceive command, like
/iot modbus transceive address=1 function=1 data=00000006 (read 6 coil registers from 0 - 5, it will return a decimal number what can be processed to become digitals)
/iot modbus transceive address=1 function=2 data=00000009 (read 9 discrete registers from 0 - 8, it will return a decimal number what can be processed to become digitals)
/iot modbus transceive address=1 function=3 data=000000AA (read 170 holding registers from 0 - 169, it will return 170 decimal numbers in an array)
/iot modbus transceive address=1 function=4 data=000000AA (read 170 input registers from 0 - 169, it will return 170 decimal numbers in an array)
I would like to write the coil registers with function 5 or 15 and write holding registers with function 6 or 16, but based on the description, I'm not able to find how to do that.
Any example code is appreciated.
Thank you.
I'm pretty fine reading any kind of registers with the KNOT device via the transceive command, like
/iot modbus transceive address=1 function=1 data=00000006 (read 6 coil registers from 0 - 5, it will return a decimal number what can be processed to become digitals)
/iot modbus transceive address=1 function=2 data=00000009 (read 9 discrete registers from 0 - 8, it will return a decimal number what can be processed to become digitals)
/iot modbus transceive address=1 function=3 data=000000AA (read 170 holding registers from 0 - 169, it will return 170 decimal numbers in an array)
/iot modbus transceive address=1 function=4 data=000000AA (read 170 input registers from 0 - 169, it will return 170 decimal numbers in an array)
I would like to write the coil registers with function 5 or 15 and write holding registers with function 6 or 16, but based on the description, I'm not able to find how to do that.
Any example code is appreciated.
Thank you.