Logic Machine Forum
Modbus write multiple registers - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: Modbus write multiple registers (/showthread.php?tid=628)



Modbus write multiple registers - Alferov - 17.02.2017

Hello!

fw 20160927
  
Modbus
Code:
if not mb then
    mbproxy = require('mbproxy')
    mb = mbproxy.new()
end
mb:setslave(4)

res, err = mb:writemultipleregisters(46165, o1, o2, o3)
if err then log(err); end

Quote:Logs: *string: Illegal function



What not so?


RE: Modbus write multiple registers - admin - 17.02.2017

This is a reply from the slave telling that this function is not supported. Actually, writemultipleregisters only make sense when writing one register to a device which only supports function code 16. With multiple registers writemultipleregisters and writeregisters are identical. Try using writeregisters and write only one register at a time.


RE: Modbus write multiple registers - Alferov - 17.02.2017

In a manual on the device it is written what can be written in this address only through function 16.
I tried writeregisters - too an error: Illegal data!

p.s.
this device - http://bolid.ru/files/373/566/s2_pp_v124_modbus_only_e.pdf


RE: Modbus write multiple registers - Erwin van der Zwart - 17.02.2017

Hi,

Do you have jumper XP1 set to master mode?

Writing to multiple register starting at 46165 is only possible when device is master according to manual.

BR, 

Erwin