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.

Link object address to modbus register
#4
Hi,

2020 is not a register, it's the number you need for the command interface that is build into the iEM devices, with this interface you can do everything on the device over the modbus connection that usually is done on the display of the device. To use the command interface you must disable the COM protection on the device by using the display once (default enabled).

After that you can use this script to reset the counters:
Code:
require('luamodbus')
mb = luamodbus.rtu()
mb:open('/dev/RS485', 19200, 'E', 8, 1, 'H')
mb:connect()
mb:setslave(1) -- Enter the correct Modbus slave address of the kWh meter

-- Reset partial counters
mb:writeregisters(5249, 2020, '')

-- Results of Reset partial counters
r1, r2 = mb:readregisters(5374, 2)
log ("Result Command: " .. r1) 
log ("Result Code: " .. r2) -- 0 = valid operation, 3000 = invalid Operation, 3001 = Invalid Parameter, 3002 = Invalid number of parameters, 3007 = Operation not perfomed

mb:close()

BR,

Erwin
Reply


Messages In This Thread
RE: Link object address to modbus register - by Erwin van der Zwart - 17.01.2018, 21:23

Forum Jump: