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
#1
Hello everybody.

Trying to implement communication between LM5 and Deye Hybrid Solar Inverter.
Reading of holding registers is working fine, objects are assigned and being updated normally. However writing is not working.

I had an assumption that writing into object will automatically update corresponding register in slave device. Looks like this assumption was wrong, please confirm?
If so, what is the procedure to write into holding register in slave device? Only trough LUA scripting?

Here is a piece of code I'm trying to use to write a register from LUA script however register is not updated. No any errors in the log. What could be wrong here:

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

--writing 10 into register 168
mb:writeregisters(168, 10)

mb:close()

Thank you.
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

Forum Jump: