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 profile - read_count
#2
You can read multiple registers via a profile but this decimal data type is not supported.
First, use read test to find the correct register address. It can be 40001, 40000 or 0.

Use this script for reading. Keep the relevant RTU port enabled in the Modbus tab. Change device id (2) and address (40001) as needed.
Code:
mbproxy = require('mbproxy')
mb = mbproxy.new()
mb:setslave(2)

r1, r2, r3, r4 = mb:readregisters(40001, 4)

-- read ok
if r1 then
  consumption = r1 + r2 / 10000
  flowrate = r3 + r4 / 10000

  log(consumption, flowrate)
else
  log('read failed', r2)
end
Reply


Messages In This Thread
Modbus profile - read_count - by bguillerey - 15.09.2025, 09:57
RE: Modbus profile - read_count - by admin - 15.09.2025, 10:06

Forum Jump: