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.

Turck modbus communication
Hi everyone, I'm trying to communicate with a Turck gateway, I have write a simple resident script to ask cyclical a value of the power supply, it works for a n numbers of request then the Turck passes me  'nill'
Any suggest?
Best regards 

This is my script 

if not mb then
    mb = luamodbus.tcp()
  mb:open('', 502)
  log('stato modebus ', mb)

-- loop while condition is met
while (1) do
  -- read from address 1000
value = mb:readinputregisters(9216)
  log('valore di value',value)
  -- wait for 1.5 seconds
Your script does not handle disconnect from the modbus device. You should use profile instead because it can reconnect automatically.
Ok thanks so I need to create a profile.
Best regards

Forum Jump: