Read individual holding register

Forum Home Forums Communicating with Devices Modbus Read individual holding register

This topic contains 5 replies, has 2 voices, and was last updated by Mikhail Mikhail 4 weeks, 1 day ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #5735
    Avatar
    ns.fariz
    Participant

    Hi Mikhail,
    I have successfully connect rapidscada to modbus device with function 3. And now, I have problem for reading some function, it’s explained that one modbus address can be divided to some output.

    9
    Mains low voltage
    0
    15
    13/16-16/16

    Mains high voltage
    0
    15
    9/16-12/16

    Bus failed to close
    0
    15
    5/16-8/16

    Bus failed to open
    0
    15
    1/16-4/16

    Please look above data, it divide 16 bit data to represent 4 output. How can I achieve that with rapidscada?

    Sorry for my English, I hope I can explain it better.

    Thank you for great software

    #5739
    Mikhail
    Mikhail
    Moderator

    Hi,

    I’m not sure that I understand the question. But likely you need to create extra input channels of the Calculated real type. And use the Formula field of these channels to define the calculations.

    #5740
    Avatar
    ns.fariz
    Participant

    Hi Mikhail,

    I need to read alarm from register offset 2048. But manufacturer put it 4 alarm at one register 16 bit. So 1-4 bit is High Oil Temperature, 5-8 High Coolant Temperature, 9-12 Low Oil Pressure, 13-16 Emergency Stop. And modbus device will return value from 0-15 depending on alarm condition. So I need to read 1-4 bit of register offset 2048. what formula it is I can use?

    #5741
    Mikhail
    Mikhail
    Moderator

    Hi,
    The idea I wrote before is true.

    For example, to get bits 5-8, you need a formula:
    ((UInt16)Val(101) & 0x0078) >> 4
    where 101 is the source input channel.
    Note: I didn’t test the formula.

    #5743
    Avatar
    ns.fariz
    Participant

    Thanks, I will try it.
    But, could you explain what this code mean? I want to understand it, so I can use for another alarm.

    #5747
    Mikhail
    Mikhail
    Moderator

    This code performs bit operations. It uses C# syntax. You can find &, >> in C# documentation.
    Val() gets the channel value.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.