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.

Turck modbus communication
#2
As suggested earlier you should use a profile instead of a script.
Here's a script that handles disconnect correctly. Make sure that script sleep time is larger than 0.
Code:
if not mb then
  require('luamodbus')
  mb = luamodbus.tcp()
  mb:open('192.168.0.162', 502)
  res = mb:connect()
  log('stato modebus', res)
end

if mb then
  value = mb:readinputregisters(9216)
  log('valore di value', value)
  
  if not value then
    mb:close()
    mb = nil
  end
end
Reply


Messages In This Thread
Turck modbus communication - by CristianAgata - 31.07.2020, 17:17
RE: Turck modbus communication - by admin - 01.08.2020, 07:43

Forum Jump: