06.06.2023, 14:07
I have tried to connect one LogicMachine ModbusRTU as Slave, and another LogicMachine ModbusRTU as Master (using profiles), and it doesnt word, then
I have tested using one LogicMachine ModbusTCP as Slave, and another LogicMachine ModbusTCP as Master (using profiles), and it works, very well.
I have connected both Logicmachine using interface RS485-1 (A-A, B-B)
The code I am using is:
local mb = require('user.mbslave')
local mbrtu = require('luamodbus').rtu()
mbrtu:open('/dev/RS485-1', 115200, 'E', 8, 1, 'H')
mbrtu:connect()
mbrtuetslave(1) -- '*' handles multiple RTU slave IDs
mb.setmapping({
--[slave ID = 1]
[1] = {
coils = {
[0] = '32/0/13', -- On/Off Luces Dpto. Técnico
[1] = '32/0/113', -- Estado On/Off Luces Dpto. Técnico
},
registers = {
[0] = '32/2/24', -- Luminosidad Dpto. Técnico
[10] = '32/2/23', -- TConsigna AACC Dpto.Técnico
[11] = '32/2/123', -- Estado TConsigna AACC Dpto.Técnico
}
}
})
mb.setswap('w')
mb.setfloat16precision(2)
while true do
mb.rtuhandler(mbrtu)
end
Am I doing something wrong?, Anybody have tested it?
best regards
I have tested using one LogicMachine ModbusTCP as Slave, and another LogicMachine ModbusTCP as Master (using profiles), and it works, very well.
I have connected both Logicmachine using interface RS485-1 (A-A, B-B)
The code I am using is:
local mb = require('user.mbslave')
local mbrtu = require('luamodbus').rtu()
mbrtu:open('/dev/RS485-1', 115200, 'E', 8, 1, 'H')
mbrtu:connect()
mbrtuetslave(1) -- '*' handles multiple RTU slave IDs
mb.setmapping({
--[slave ID = 1]
[1] = {
coils = {
[0] = '32/0/13', -- On/Off Luces Dpto. Técnico
[1] = '32/0/113', -- Estado On/Off Luces Dpto. Técnico
},
registers = {
[0] = '32/2/24', -- Luminosidad Dpto. Técnico
[10] = '32/2/23', -- TConsigna AACC Dpto.Técnico
[11] = '32/2/123', -- Estado TConsigna AACC Dpto.Técnico
}
}
})
mb.setswap('w')
mb.setfloat16precision(2)
while true do
mb.rtuhandler(mbrtu)
end
Am I doing something wrong?, Anybody have tested it?
best regards