Write multiple modbus register FC=16

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

Tagged: 

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #7963
    ns.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
    Mikhail
    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
    ns.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
    Mikhail
    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 1 year, 4 months ago by Mikhail.
    #8001
    ns.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
    Mikhail
    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
    ns.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
    manjey73
    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
    Mikhail
    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
    ns.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
    manjey73
    Participant

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

    #8064
    Mikhail
    Moderator

    Hi,

    how can I set modbus device ID?

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

    #8081
    ns.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
    Mikhail
    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.

    #9405
    panggah
    Participant

    Hi Mikhail,

    i have tried this method, but still can’t worked.

    there are my line log.
    can you help me? thanks

    2021-08-13 13:58:11 Command to the Device 1 “tes remote”, type: KpModbus, address: 10, call number: 10.13.118.19
    Command “remoted”
    Send (17): 00 D4 00 00 00 0B 0A 10 10 07 00 02 04 8B 74 74 8B
    Receive (7/7): 00 D4 00 00 00 03 0A
    Receive (2/2): 90 02
    Device error: [02] ILLEGAL DATA ADDRESS!
    Command “remoted”
    Send (17): 00 D5 00 00 00 0B 0A 10 10 07 00 02 04 8B 74 74 8B
    Receive (7/7): 00 D5 00 00 00 03 0A
    Receive (2/2): 90 02
    Device error: [02] ILLEGAL DATA ADDRESS!
    Command “remoted”
    Send (17): 00 D6 00 00 00 0B 0A 10 10 07 00 02 04 8B 74 74 8B
    Receive (7/7): 00 D6 00 00 00 03 0A
    Receive (2/2): 90 02
    Device error: [02] ILLEGAL DATA ADDRESS!

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