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.

Function 16 modbus
#1
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?
Reply
#2
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/showthrea...29#pid6729
------------------------------
Ctrl+F5
Reply
#3
(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.
https://openrb.com/docs/modbus.htm
https://forum.logicmachine.net/showthrea...29#pid6729

Thanks
Reply
#4
(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.
https://openrb.com/docs/modbus.htm
https://forum.logicmachine.net/showthrea...29#pid6729
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""" }            
    ]
Reply
#5
Try address 33, are you sure it is inputregister?
------------------------------
Ctrl+F5
Reply
#6
And make sure you use firmware from 2021
------------------------------
Ctrl+F5
Reply
#7
(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.
Reply
#8
This is not supported in this fw. Install RC2 2021
------------------------------
Ctrl+F5
Reply


Forum Jump: