Logic Machine Forum
Modbus one register to two objects - Printable Version

+- Logic Machine 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: Modbus one register to two objects (/showthread.php?tid=4381)



Modbus one register to two objects - a455115 - 15.11.2022

Hello,

 I need to split a modbus register to control two lamps on one register. i guess i need to put a bitmask on but i'm not sure what it should be. I am attaching the registry table.
Code:
Address    High byte                                         Low byte
00H    Channel No.1 output value                         Channel No.2 output value
01H    Channel No.3 output value                         Channel No.4 output value
02H    Channel No.1 control register                         Channel No.2 control register
03H    Channel No.3 control register                         Channel No.4 control register
200H    Device ID                                         Connect register
201H    Switch delay register                                 Smooth register
202H    Reserve                                              Reserve
203H    Reserve                                                 Reserve
204H    Reserve                                                 Reserve
205H    Reserve                                                 Reserve
206H    Switch No.1 click value.                         Switch No.2 click value.
207H    Switch No.3 click value.                         Switch No.4 click value.
208H    Channel No.1 power on value                          Channel No.2 power on value
209H    Channel No.3 power on value                         Channel No.4 power on value



Set channel No.1 output value is 0(off), channel No.2 output value is 32(50%)

Send:  60 06 00 00 00 20 80 63
Ans:   60 06 00 00 00 20 80 63



Set channel No.1 output value is 63(100%). Channel No.2 output value is unchanged.

Send:  60 06 00 00 3F FF D0 0B
Ans:   60 06 00 00 3F FF D0 0B


Get Channel 1-4 output value

Send:  60 03 00 00 00 02 CC 7A
Ans:   60 03 04 3F 20 00 00 87 2B



RE: Modbus one register to two objects - admin - 15.11.2022

0xFF00 and 0x00FF, don't forget to add "write_bitmask": true


RE: Modbus one register to two objects - a455115 - 17.11.2022

(15.11.2022, 09:21)admin Wrote: 0xFF00 and 0x00FF, don't forget to add "write_bitmask": true

The mask 0xFF00 and 0x00FF, what should I write it in?


RE: Modbus one register to two objects - Daniel - 17.11.2022

See this example of bit-mask use
https://forum.logicmachine.net/showthread.php?tid=4311&pid=28317#pid28317


RE: Modbus one register to two objects - a455115 - 23.11.2022

(17.11.2022, 13:01)Daniel Wrote: See this example of bit-mask use
https://forum.logicmachine.net/showthread.php?tid=4311&pid=28317#pid283
Thanks!