Write multiple modbus register FC=16

Forum Home Forums Communicating with Devices Modbus Write multiple modbus register FC=16

Tagged: 

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #7963
    Avatarns.fariz
    Participant

    Hi..

    I try to write multiple holding register 4104 and 4105, each with different 16bits value. So I made command template like this picture below

    template

    Then I put a table to send command, but it’s only one command. How can I make 2 different value sent to each modbus register with single command? I need to write 35700 to modbus register 4104 and 29834 to modbus register 4105.

    tabel

    I hope you understand what I mean.

    Thank you.

    #7967
    MikhailMikhail
    Moderator

    Hi,

    A user can input only one value in the command dialog. It’s possible to send 2 values using formulas. What is the meaning of this command for a user? Is it possible to simplify input for him? For example, a user just click “Execute” and the predefined values are sent to controller.

    #7970
    Avatarns.fariz
    Participant

    Hi Mikhail,

    User just klik a button, and pre-defined value send to modbus with write to multiple register 4104-4105 like I have explained in the previous post. What formula I can use? And where to put them? Do I need create another output channels?

    #7984
    MikhailMikhail
    Moderator

    Hi,

    You need only one output channel. Set the Command Values field to “Execute”, set Command Type to Binary and enable Formula used.

    Set the formula:
    new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }

    Check how it works, and what are the register values sent as a result. Copy here communication log, containing the command.

    • This reply was modified 3 months ago by MikhailMikhail.
    #8001
    Avatarns.fariz
    Participant

    Hi,

    Thank you for your reply. But could you explain to me about this syntax? Is it make array? but { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x07 } what is this number? It’s neither 35700 nor 29834 .

    #8010
    MikhailMikhail
    Moderator

    Hi,

    This array is very useful to check byte order in the packet sent to the controller. After we check it, we can replace 1..8 to the specific values 35700 and 29834.

    #8039
    Avatarns.fariz
    Participant

    Hi,

    I tried formula above. Please see line log below. `2021-01-16 14:46:09 Command to the Device 1 “Gen 1”, type: KpModbus
    Command “Auto”
    Send (17): 01 EF 00 00 00 0B 00 10 10 08 00 02 04 01 02 03 04
    Receive (7/7): 01 EF 00 00 00 03 00
    Receive (2/2): 90 02
    Device error: [02] ILLEGAL DATA ADDRESS!
    Command “Auto”
    Send (17): 01 F0 00 00 00 0B 00 10 10 08 00 02 04 01 02 03 04
    Receive (7/7): 01 F0 00 00 00 03 00
    Receive (2/2): 90 02
    Device error: [02] ILLEGAL DATA ADDRESS!
    Command “Auto”
    Send (17): 01 F1 00 00 00 0B 00 10 10 08 00 02 04 01 02 03 04
    Receive (7/7): 01 F1 00 00 00 03 00
    Receive (2/2): 90 02
    Device error: [02] ILLEGAL DATA ADDRESS!

    `

    What is that mean?

    #8040
    Avatarmanjey73
    Participant

    00 Unit identifier 0x00 (0)

    Specify in the database, in addition to the IP address, also the address for the RTU mode, if the device has the ability to poll on the 485 interface or just 1

    #8044
    MikhailMikhail
    Moderator

    Using Modbus Parser that the sent value is 0x0102, 0x0304. So if you change these bytes in the formula to 0x8B, 0x74, 0x74 and 0x8A, you will get what you need.

    And yes, may be you should set Modbus device ID (unit ID).

    #8049
    Avatarns.fariz
    Participant

    Hi,

    I’m using modbus TCP. how can I set modbus device ID? I just set IP address and used to fine to read modbus register.

    #8050
    Avatarmanjey73
    Participant

    Some devices may not respond if no ID is specified, even over TCP

    #8064
    MikhailMikhail
    Moderator

    Hi,

    how can I set modbus device ID?

    Set the device address in the Devices table. After uploading the project, check logs.

    #8081
    Avatarns.fariz
    Participant

    Hi,

    It’s work perfect. I set modbus command address for the same register. and set it on channel output for each command with different value.

    But I have problem for making simple table. No value output even I have set up input channel in table. What’s wrong with my configuration? I can not find any error log which are related with input channel.

    Channel input 1
    channel input 2

    gen 1 read

    tableview

    #8084
    MikhailMikhail
    Moderator

    Hi,

    It’s work perfect.

    Good!

    The new error is related to the installation of the web app. Please create a new topic to discuss it.

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