02.02.2017, 13:35
(02.02.2017, 12:09)admin Wrote: Replace this:
Code:-- modbus slave, listen on all interfaces and default port 502
mb = luamodbus.tcp()
mb:open('0.0.0.0', 502)
-- setting slave id is optional
-- mb:setslave(1)
With this (adjust serial settings and slave id as needed):
Code:mb = luamodbus.rtu()
mb:open('/dev/RS485', 9600, 'E', 8, 1, 'H')
mb:connect()
mb:setslave(1)
RS-232 is mostly used for ModBus ASCII which is not supported.
works like a charm
but needed to change port to /dev/RS485-1 to make it working