13.07.2017, 15:51
This generating a test to be able to check the Modbus TCP communication, but when I put four data it jumps to the next address and does not take me in data that I send it. What could be failing?
I am using this code: http://openrb.com/lm-as-modbus-tcp-slave
CODE:
if not mb1 then
require('luamodbus')
mb1 = luamodbus.tcp()
mb1:open('192.168.0.10', 502)
mb1:connect()
end
--Data1ModbusTCP
coil = mb1:readcoils(0)
grp.write('5/1/1', coil)
--Dato2ModbusTCP
coil2 = mb1:readcoils(0)
grp.write('5/1/2', coil2)
--Dato3ModbusTCP
register = mb1:readregisters(0)
grp.write('5/1/3', register)
--register2 = mb1:readregisters(0)
--grp.write('5/1/4', register2)
I am using this code: http://openrb.com/lm-as-modbus-tcp-slave
CODE:
if not mb1 then
require('luamodbus')
mb1 = luamodbus.tcp()
mb1:open('192.168.0.10', 502)
mb1:connect()
end
--Data1ModbusTCP
coil = mb1:readcoils(0)
grp.write('5/1/1', coil)
--Dato2ModbusTCP
coil2 = mb1:readcoils(0)
grp.write('5/1/2', coil2)
--Dato3ModbusTCP
register = mb1:readregisters(0)
grp.write('5/1/3', register)
--register2 = mb1:readregisters(0)
--grp.write('5/1/4', register2)