07.05.2018, 11:30
Make sure that the client connections are closed properly. There's a limit on active connections to modbus TCP slave.
Mapping will always start from 0. You can specify mapping like this (+1 is need because Lua table start from 1, modbus addressing starts from 0):
Since mapping table will not be a continuous array, you will have to set mapping like this:
Mapping will always start from 0. You can specify mapping like this (+1 is need because Lua table start from 1, modbus addressing starts from 0):
Code:
registers = {}
registers[ 100 + 1 ] = '1/1/1' -- mb register 100
registers[ 101 + 1 ] = '1/1/2' -- mb register 101
Since mapping table will not be a continuous array, you will have to set mapping like this:
Code:
mb:setmapping(table.maxn(coils), 0, table.maxn(registers), 0)