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.

read failed: Illegal data address
#9
1-byte value comes from the example that you gave in another thread, that I tried to understand. I have no clue to be honest. Smile
In this register there are 32 writable bits, some of them are reserved though.
https://forum.logicmachine.net/showthrea...24#pid6824

Bit 4 (bypass) and bit 5 (out of bypass) are exclusive as they both control the state of the UPS. I can only write true to one of them because it toggles between thoose states, either bypass or online.

Am I in the ball park with this script? Setting bit 4 in 1536 to true.

Code:
require('luamodbus')
mb = luamodbus.tcp()
mb:open('192.168.1.228', 502)
mb:connect()
mb:setslave(11)

function setbit(value, nr)
 return bit.bor(value, bit.lshift(1, nr))
end

value = 1

value = setbit(value, 4)

mb:writeregisters(1536, value)

mb:close()


log(value) -- result: 17
Reply


Messages In This Thread
read failed: Illegal data address - by sx3 - 08.05.2018, 19:41
RE: read failed: Illegal data address - by sx3 - 10.05.2018, 08:08

Forum Jump: