This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

luamodbus documentation
#10
You can enable debug mode to see what data is sent/received:
Code:
require('luamodbus')

buffer = {}

function logger(c)
table.insert(buffer, c)
end

mb = luamodbus.rtu()
mb:open('/dev/RS485-1', 9600, 'E', 8, 1, 'H')
mb:connect()
mb:setslave(1)
mb:setdebug(logger)

-- read/write here

log(table.concat(buffer))

You can also add mb:flush() after sleep to discard any invalid data that could be received.

Code:
mb:writereadregisters(write_reg_start, write_reg_value_1, write_reg_value_2, write_reg_value_3..., read_reg_start, read_reg_count)
Reply


Messages In This Thread
luamodbus documentation - by hummelsystemhaus - 07.02.2018, 14:40
RE: luamodbus documentation - by admin - 13.02.2018, 11:23
RE: luamodbus documentation - by admin - 15.02.2018, 09:25
RE: luamodbus documentation - by admin - 16.02.2018, 13:04
RE: luamodbus documentation - by Thomas - 20.06.2019, 15:47
RE: luamodbus documentation - by admin - 20.06.2019, 16:59
RE: luamodbus documentation - by Thomas - 21.06.2019, 11:32
RE: luamodbus documentation - by admin - 21.06.2019, 12:05
RE: luamodbus documentation - by AngelesTR - 10.01.2023, 15:19
RE: luamodbus documentation - by admin - 11.01.2023, 08:22
RE: luamodbus documentation - by AngelesTR - 11.01.2023, 10:08
RE: luamodbus documentation - by admin - 11.01.2023, 10:14
RE: luamodbus documentation - by AngelesTR - 11.01.2023, 11:57

Forum Jump: