09.02.2022, 00:50
Hi can anybody give me some tips for modbus writing with a bitmask?
The case is resetting an alarm on a cooling machine (Eliwell ST500 controller). Attached is the relevant part of the Modbus manual of the ST500 controller.
As I consulted the forum I tried this:
---
require('luamodbus')
mb = luamodbus.rtu()
mb:open('/dev/RS485', 9600, 'N', 8, 1, 'H')
mb:connect()
mbetslave(3) -- Enter the correct Modbus slave address of Airco
function setbit(value, nr)
return bit.bor(value, bit.lshift(1, nr))
end
value = 1
value = setbit(value, 2)
mb:writeregisters(33471, value)
----
But I doesn't seem to work. The error stays. Any other things like reading values or writing setpoints work like a charm.
What do I do wrong?
The case is resetting an alarm on a cooling machine (Eliwell ST500 controller). Attached is the relevant part of the Modbus manual of the ST500 controller.
As I consulted the forum I tried this:
---
require('luamodbus')
mb = luamodbus.rtu()
mb:open('/dev/RS485', 9600, 'N', 8, 1, 'H')
mb:connect()
mbetslave(3) -- Enter the correct Modbus slave address of Airco
function setbit(value, nr)
return bit.bor(value, bit.lshift(1, nr))
end
value = 1
value = setbit(value, 2)
mb:writeregisters(33471, value)
----
But I doesn't seem to work. The error stays. Any other things like reading values or writing setpoints work like a charm.
What do I do wrong?