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.

Modbus connection status (mbproxy)
#1
Hello,

I have this code for reading modbus values. It is in resident script ~20s.
Now I need to make an alarm if there is no modbus connection and we are not getting new values.
How can I do it?

Code:
mbproxy = require('mbproxy')
mb = mbproxy.new()
mb:setslave(2)

--Actual temp
grp.write('32/3/1', (mb:readinputregistervalue(8203, 'uint16')/10),dt.float16)
os.sleep(0.5)
--Setpoint temp
grp.write('32/3/2', (mb:readinputregistervalue(8202, 'uint16')/10),dt.float16)
os.sleep(0.5)

Thanks.
Reply
#2
mb:read... function will return nil when device cannot be reached.
Reply


Forum Jump: