Send command button – change register bit

Forum Home Forums Communicating with Devices Modbus Send command button – change register bit

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6786
    Avatarcooldjmc
    Participant

    Hi, please if some one can help me if is possible to send command to change only one bit in a modbus register and not modify other register bits. For example if i have one register 0110 0110 1000 0110 and i want to change only the second bit to 0 is is possible to use one Button to send command (something like SetBit? )?

    Thanks.

    #6787
    MikhailMikhail
    Moderator

    Hi,

    Set a formula for the output channel.
    Something like this (not tested):
    (ushort)Val(101) | ((Cmd > 0 ? 1 : 0) << 2)
    There the input channel #101 stores the current value of the register.

    #6788
    Avatarcooldjmc
    Participant

    Thank you Mikhail for your quick response, i will try that and post the results.

    Have a nice weekend!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.