![]() |
Function 16 modbus - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10) +--- Thread: Function 16 modbus (/showthread.php?tid=3596) |
Function 16 modbus - AndresMezaAyala - 29.09.2021 Hi, I have this register: 0022H ---uint16 This has 16 bits, counting from 0 to 15, bits 12 and 13 are for the activation of a relay, how do I write to those bits with the 16 modbus function? RE: Function 16 modbus - Daniel - 29.09.2021 Add write_multiple to force to use function 16. Use value_bitmask and write_bitmask to write to specific bits. https://openrb.com/docs/modbus.htm https://forum.logicmachine.net/showthread.php?tid=839&pid=6729#pid6729 RE: Function 16 modbus - AndresMezaAyala - 29.09.2021 (29.09.2021, 16:55)Daniel Wrote: Add write_multiple to force to use function 16. Use value_bitmask and write_bitmask to write to specific bits. Thanks RE: Function 16 modbus - AndresMezaAyala - 29.09.2021 (29.09.2021, 16:55)Daniel Wrote: Add write_multiple to force to use function 16. Use value_bitmask and write_bitmask to write to specific bits.So I have the Json but it is not working for me, can it be done by script? and how? { "manufacturer": "PRUEBA", "description": "prueba", "mapping": [ { "name": "Salida 1", "bus_datatype": "bool", "datatype": "uint16", "type": "inputregister", "address": 34, "value_bitmask": "0x1000", "write_multiple": 1, "writable": 1, "bus_address": "" }, { "name": "Salida 2", "bus_datatype": "bool", "datatype": "uint16", "type": "inputregister", "address": 34, "value_bitmask": "0x2000", "writable": 1, "write_multiple": 1, "bus_address": "" } ] } RE: Function 16 modbus - Daniel - 29.09.2021 Try address 33, are you sure it is inputregister? RE: Function 16 modbus - Daniel - 29.09.2021 And make sure you use firmware from 2021 RE: Function 16 modbus - AndresMezaAyala - 29.09.2021 (29.09.2021, 19:45)Daniel Wrote: And make sure you use firmware from 2021 I am using version 20190904, but, That register, bits 8 and 9 are for reading input values, and it is marking me reading normally. The problem is when I want to write to those bits. RE: Function 16 modbus - Daniel - 29.09.2021 This is not supported in this fw. Install RC2 2021 |