15.02.2021, 16:41
Code:
require('luamodbus')
mb = luamodbus.rtu()
mb:open('/dev/RS485-1', 9600, 'N', 8, 1, 'H')
mb:connect()
buffer = {}
mb:setdebug(function(msg)
buffer[ #buffer + 1 ] = msg
end)
mb:setslave(8)
res = { mb:readregisters(3109, 2) }
log(res)
mb:close()
log(table.concat(buffer))
I disabled RTU in mapper and then tried it, it suppose to log something about frequency (tried with reading test) unfortunately it keeps logging that
* string: [08][03][0C][25][00][02][D6][09]
ERROR Bad file descriptor
i tried reading for value, specify swap, specify datatype, try different registers, change to 8N2...
What I'm doing wrong?