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 whether you accept or reject these cookies being set.

Modbus TCP connection datakom d-200 mk2
Seems to be a networking issue of some kind. Try running the same script with debug mode enabled and post what you get in Logs tab.
if not mb then
  mb = luamodbus.tcp()

  mb:open('', 502)

  res, err = mb:connect()
  if res then
    buffer = {}
      buffer[ #buffer + 1 ] = msg
    log('modbus connect failed ' .. tostring(err))
    mb = nil

if mb then
  reg10240, reg10241, reg10242, reg10243, reg10244, reg10245, reg10246, reg10247 = mb:readregisters(10240, 8)
  if reg10240 then
    mains_l1_voltage = reg10240 / 10
    mains_l2_voltage = reg10242 / 10
    mains_l3_voltage = reg10244 / 10
    genset_l1_voltage = reg10246 / 10
    log('voltage values', mains_l1_voltage, mains_l2_voltage, mains_l3_voltage, genset_l1_voltage)
    buffer = {}
    log('modbus read failed ' .. tostring(reg10241))
    mb = nil

Messages In This Thread
RE: Modbus TCP connection datakom d-200 mk2 - by admin - 23.02.2021, 09:09

Forum Jump: