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.

LM as a Modbus slave : number of slaves
#10
(09.08.2022, 11:30)admin Wrote: "Connection refused" means that either your slave script is not running or it's not using port 502. The test script is a master that checks if a local slave is running or not.

I use your previous script, that I run. Then I run your test script.
Did I make a mistake ?

Code:
if not mb then
  require('luamodbus')
  mb = luamodbus.tcp()

  mb:open('0.0.0.0', 502)
  mb:setslave(2)

  function setint64(grpaddr, regaddr)
    local value = grp.getvalue(grpaddr) or 0
    local raw = knxdatatype.encode(value, dt.int64).dataraw
    local r1 = raw:byte(2) * 0x100 + raw:byte(1)
    local r2 = raw:byte(4) * 0x100 + raw:byte(3)
    local r3 = raw:byte(6) * 0x100 + raw:byte(5)
    local r4 = raw:byte(8) * 0x100 + raw:byte(7)

    mb:setregisters(regaddr, r4, r3, r2, r1)
  end

  function updateregisters()
    setint64('32/1/1', 3204)
  end
Reply


Messages In This Thread
RE: LM as a Modbus slave : number of slaves - by SigmaTec - 09.08.2022, 11:34

Forum Jump: