![]() |
|
read value from two modbus adresses - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: read value from two modbus adresses (/showthread.php?tid=4998) |
read value from two modbus adresses - mellotron - 30.09.2023 hi please how can i read the value in 32bit format which use 2 modbus adresses one for lsb and other fr msb in logic magine RE: read value from two modbus adresses - Erwin van der Zwart - 30.09.2023 Try this: Code: require('luamodbus')
mb = luamodbus.rtu()
mb:open('/dev/RS485', 19200, 'N', 8, 1, 'H')
mb:connect()
mb:setslave(1)
value = mb:readregistervalue(1234,"float32","n")
-- n=no swap, w=word swap, b=byte swap, bw=byte and word swap
mb:close() |