02.02.2017, 12:09
Replace this:
With this (adjust serial settings and slave id as needed):
RS-232 is mostly used for ModBus ASCII which is not supported.
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.