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.

Modbus bit control over script
#1
Hi,
Same ideas how can I control Modbus bit over script. Reading works for mee so I need write commands over Event script.

Code:
local adr1001 = mb:readregistervalue(1001, 'uint16')
grp.write('32/5/52', bit.band(bit.rshift(adr1001,8),0x1), dt.bool)  -- Baseino filtravimo laikmatis jei abu isjungti
grp.write('32/5/53', bit.band(bit.rshift(adr1001,9),0x1), dt.bool)  -- Filtravimas vyksta istisai
grp.write('32/5/54', bit.band(bit.rshift(adr1001,10),0x1), dt.bool)     --Vonios filtravimo laikmatis jei abu isjungti
grp.write('32/5/55', bit.band(bit.rshift(adr1001,11),0x1), dt.bool)     --Filtravimas vyksta istisai
   
Reply
#2
Hi
As long it is register you have to build back the 2 byte and send it as register. Usually bit control is done via coil.
BR
------------------------------
Ctrl+F5
Reply
#3
You should also use modbus mapper proxy functions if you want to access same RS485 port from several scripts. Otherwise you will get random access errors. https://forum.logicmachine.net/showthrea...53#pid1953
Reply


Forum Jump: