This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

write to modbus with bitmask
#1
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()
mbConfusedetslave(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?

Attached Files Thumbnail(s)
   
Reply


Messages In This Thread
write to modbus with bitmask - by jeroen@stevens.biz - 09.02.2022, 00:50
RE: write to modbus with bitmask - by admin - 09.02.2022, 07:52
RE: write to modbus with bitmask - by admin - 10.02.2022, 08:25
RE: write to modbus with bitmask - by admin - 11.02.2022, 08:03

Forum Jump: