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
#7
First, check the Error log for any errors.
You can use this test script for reading from local TCP slave with port 502 (check Logs tab for the read result or any errors):
Code:
require('luamodbus')

mb = luamodbus.tcp()
mb:open('127.0.0.1', 502)
res, err = mb:connect()

if res then
  val, err = mb:readregistervalue(3204, 'int64', 'b')
  
  if val then
    log('read ok', val)
  else
    log('read failed', err)
  end
else
  log('connect failed', err)
end

mb:close()
Reply


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

Forum Jump: