This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Modbus Multiple Write Problems (write_multiple=true)
#1
I am creating a profile with Modbus Profiler application
I am trying to send a single Modbus TCP frame using function 16 (0x10) to write 4 consecutive registers (0x0003–0x0006) but only register 0x0003 is sent with the function (0x10). I have tried sending from Modbus Poll and it works perfectly and I have also read with Modbus Slave what LM sends and I have received

Rx:269-17:49:44.026-00 01 00 00 00 09 01 10 00 03 00 01 02 00 05

Code:
{"manufacturer":"DT","description":"DT16",
"mapping":[
{"bus_address":"36/3/0","bus_datatype":"uint16","write_only":true,"address":2,"bus_write":false,"datatype":"uint16","writable":true,"type":"register","name":"Write Relay"},
{"bus_address":"36/3/1","bus_write":true,"datatype":"uint16","bus_datatype":"uint16","address":3,"type":"register","writable":true,"write_multiple":true,"name":"Advance Write Type "},
{"bus_address":"36/3/2","bus_write":true,"datatype":"uint16","bus_datatype":"uint16","address":4,"type":"register","writable":true,"write_multiple":true,"name":"Advance password"},
{"bus_address":"36/3/3","bus_write":true,"datatype":"uint16","bus_datatype":"uint16","address":5,"type":"register","bus_write":true,"writable":true,"write_multiple":true,"name":"Advance Write Relay"},
{"bus_address":"36/3/4","bus_write":true,"datatype":"uint16","bus_datatype":"uint16","type":"register","address":6,"writable":true,"bus_write":true,"name":"Advance Write Time "},
{"bus_address":"36/0/1","value_delta":0.2,"datatype":"int16","bus_datatype":"bool","address":22,"type":"register","writable":false,"bus_write":false,"name":"Estado entrada 1"},
{"bus_address":"36/0/2","value_delta":0.2,"datatype":"int16","bus_datatype":"bool","address":23,"type":"register","writable":false,"bus_write":false,"name":"Estado entrada 2"},
{"datatype":"int16","bus_datatype":"bool","address":24,"writable":false,"type":"register","name":"Estado entrada 3"},{"datatype":"int16","bus_datatype":"bool","address":25,"writable":false,"type":"register","name":"Estado entrada 4"},
{"datatype":"int16","bus_datatype":"bool","address":26,"writable":false,"type":"register","name":"Estado entrada 5"},{"bus_address":"36/1/1","value_delta":0.2,"datatype":"int16","bus_datatype":"bool","address":54,"type":"register","writable":false,"bus_write":false,"name":"Estado salida 1"},
{"bus_address":"36/1/2","value_delta":0.2,"datatype":"int16","bus_datatype":"bool","address":55,"type":"register","writable":false,"bus_write":false,"name":"Estado salida 2"},{"datatype":"int16","bus_datatype":"bool","address":56,"writable":false,"type":"register","name":"Estado salida 3"},
{"datatype":"int16","bus_datatype":"bool","address":57,"writable":false,"type":"register","name":"Estado salida 4"},{"datatype":"int16","bus_datatype":"bool","address":58,"writable":false,"type":"register","name":"Estado salida 5"}
]
}


Can you tell me where the error is?

Thank you very much!!
Reply
#2
Modbus has two different functions for writing a single or multiple registers. Certain devices don't support single register write so write_multiple tells to use multiple register write command for a single register. It will still write only one register, not multiple registers at once. You can use a script to write multiple separate registers in one request.
Reply
#3
(Yesterday, 08:09)admin Wrote: Modbus has two different functions for writing a single or multiple registers. Certain devices don't support single register write so write_multiple tells to use multiple register write command for a single register. It will still write only one register, not multiple registers at once. You can use a script to write multiple separate registers in one request.

Okay, thanks!
Is it better to use the profile for reading and writing single records and Lua for writing multiple records? Or should I do everything from a Lua script?
Reply
#4
You can use profile for all what is possible in profile and a proxy script for the rest. Something like this:
https://forum.logicmachine.net/showthrea...3#pid36113
------------------------------
Ctrl+F5
Reply


Forum Jump: