25.05.2023, 12:36
Hi Admin
I'm trying to integrate LM with generator to read 3 phase values , fuel level etc.
I used this code to read registers LM opens port succesfully but no value writed at all.
I tried changing Rx - Tx pins already but helped not at all.
Any help would appreciated
Thanks
I'm trying to integrate LM with generator to read 3 phase values , fuel level etc.
Code:
require('luamodbus')
mb = luamodbus.rtu()
res = mb:open('/dev/RS232', 9600, 'N', 8, 1, 'H')
log(res)
if res then
mb:connect()
mb:setslave(3)
mb:setresponsetimeout(30)
-- read 3-phase system voltage
r1, r2 = mb:readregisters(10240, 2)
if r1 and r2 then
result = bit.lshift(r1, 16) + r2
grp.checkwrite('32/5/1', result)
log(result)
end
end
mb:close()
I tried changing Rx - Tx pins already but helped not at all.
Any help would appreciated
Thanks