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.

Modbus RTU - Writing Registers
#5
Yes, was trying your provided code. Log is empty.

GND is connected between LM and slave device.

Following code outputs only "Before Write". "After Write" line can't be reached, like write procedures hangs.

Code:
require('luamodbus')
mb = luamodbus.rtu()
mb:open('/dev/RS485-1', 9600, 'N', 8, 1, 'H')
mb:connect()

log("Before Write")

--writing 10 into register 168
res, err = mb:writemultipleregisters(168, 10)
log(res, err)

log("After Write")

mb:close()
Reply


Messages In This Thread
Modbus RTU - Writing Registers - by Dmitry.T - 31.10.2024, 10:17
RE: Modbus RTU - Writing Registers - by admin - 31.10.2024, 10:42
RE: Modbus RTU - Writing Registers - by admin - 31.10.2024, 11:28
RE: Modbus RTU - Writing Registers - by Dmitry.T - 31.10.2024, 11:36

Forum Jump: