How to write to multiple registers using FC 16

Hi there,
I want to write these Modbus registers (attached figure), however, I am getting confused about what to write in function code while using FC 16. I am able to write them individually using FC 06, individual function nodes, and Modbus Flex Write, but I don't know how to use FC 16 and single function node for this purpose. Thanks in advance.
image

Hi Waled

try sending an array of your values

Example Flow (change the id,starting address and Config to match your device) :

[{"id":"efa9728f.a7be6","type":"modbus-flex-write","z":"981a2a72.4329f","name":"","showStatusActivities":false,"showErrors":false,"server":"bf37180a.2d18e","emptyMsgOnFail":false,"keepMsgProperties":false,"x":610,"y":1000,"wires":[["f373a2e5.227c68"],[]]},{"id":"cb5984b6.2e3d5","type":"function","z":"981a2a72.4329f","name":"FC16","func":"msg.payload = { \n    \n    'value': msg.payload,\n    'fc': 16,\n    'unitid': 1,\n    'address': 0,\n    'quantity': 4\n    \n} \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":410,"y":1000,"wires":[["efa9728f.a7be6"]]},{"id":"2e320cc4.ec9aec","type":"inject","z":"981a2a72.4329f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[11,22,33,44]","payloadType":"json","x":230,"y":1000,"wires":[["cb5984b6.2e3d5"]]},{"id":"f373a2e5.227c68","type":"debug","z":"981a2a72.4329f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":830,"y":960,"wires":[]},{"id":"bf37180a.2d18e","type":"modbus-client","name":"","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"192.168.1.66","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":1,"commandDelay":20,"clientTimeout":1000,"reconnectOnTimeout":true,"reconnectTimeout":2000,"parallelUnitIdsAllowed":true}]

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