Modbus - Flex Write node - Parameters

Hey Guys (hopefully @Steve-Mcl is listening !)

I am using the Modbus nodes extensively and not having any troubles - except i now want to pass two parameters through the Flex-write node and can not figure out the setup - here is my current code snippet from my function node

var values = [0x001,5000];
msg.payload = { 'value': values, 'fc': 16, 'unitid': 247, 'address': 0xb997, 'quantity': 2 }

and that works fine

I want to try and combine that with a 2nd write - as such

var values = [1,10];
msg.payload = { 'value': values, 'fc': 16, 'unitid': 247, 'address': 0xb995, 'quantity': 2 }

Is it possible to set two different registers by stacking the values in a variable ? If so what should the syntax look like - i have been playing with many options today but feel like i am going around in circles.

Both writes work - and if i issue them as two sequential commands i.e. Function 1 > Modbus-write > function 2 > Modbus write it works fine - just hoping to tidy it up a bit more

regards

Craig

Hi Craig, unfortunately the modbus protocoldoes not support non-sequential reads or writes. Whether the node actually supports multiple write operations internally (doing sequential writes itself), I can't remember. But it is simple enough to simulate using link-call.

Btw, if you are are working with a PLC, the better solution is to move the addresses adjacent to one another and send a write with contiguous data - that will result in a single network packet & consistent data.

Hi Steve

Thanks (as always !) for the speedy response. !

Yeah i am working with a GoodWe Solar Inverter rather than PLC gear so pretty much stuck with what i have been given.

OK just have to tidy up my spaghetti code now from playing and learning on this new unit and live with having to do a couple of writes.

regards

Craig