Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

A Bit Stuck on Writing Multiple MODBUS Registers

  • Hey Guys, long time no post haha. I've got a tricky one here...

    I have a MODBUS device I need to write two things simultaneously to to get the required function to work.
    I have to write a function code of 2 to register 4104 and key of 35702 to 4105 simultaneously.


    I've tried putting the data in as hex or just decimal versions, on a 4 byte / 2 byte. Hair is being pulled out now and I don't have much left :P

    I've tried the fixed length option also as it allows you to select number of registers, but I can't work out how to separate the two values.

    This has to be something simple but I'm a bit lost with the syntax. Any help would be most appreciated. I'm a bit confused on this one.


  • Morning Dan,

    I've been learning modbus myself due to the ever evolving direction my company takes. Anyway!
    I did a bit of reading in the help notes and not sure if this will work but this is what they mentioned:

    The Data field is the data that will be sent. The data will be encoded as per the selected settings. When writing multiple values, separate each value with a comma.

    Hope that's of some help!


  • Hi, thanks for that. I'll give it a stab. Do you reckon it should be 2 hex values in 0x1234 type format?


  • If they're integers (16 bit) then I think that'd be preferable in at least you're consistent. I mean you could write 0x02 instead of 0x0002 but I am not sure if it will recognise that and treat it as so.

    Sorry this will be a crash course for me too man!


  • hmm, I tried
    And get this pop up error
    Then I have to refresh the page and go back in and select all the stuff again before I can have another go :-/.
    I must be close haha!

  • Then this one

  • does 0x02 not work? it's asking for a string as well... is the datatype not an integer?

  • I think it's wanting '2' then '35702' written into 4104 and 4105 respectively, both at once using function 16 multiple write.
    Here's an excerpt from the manual for what they're getting at..

    1. One of the system control keys from the table below must be written into register 8 and its ones-compliment written into register 9
      with a single function 16 (write multiple registers) to perform the specified system control function.
    2. Writing any other value or using a function that is not available will return extended exception code 7 (Illegal value written to
      register) and have no affect.

    The table looks like this..


  • @dan said in A Bit Stuck on Writing Multiple MODBUS Registers:


    I've entered it in like this since the values are a different length:

  • Oh, that makes more sense :)
    I'll try that, thanks heaps.

  • 0_1595287296908_f92e2f99-755e-4905-be74-6df858320823-image.png

  • That doesn't give you much to work with does it??

    I got this working!

  • oh yeh, that's interesting, I'll try the coils.

    Cheers for that hey.

  • FML...


    It does say Control Registers at the top of the info page..


  • So it's a nope? - note your 0x2 should be 0x02

  • Na I don't think I can write to coils on this device.

  • write
    That sets that control key and calls function 2

  • Hi Dan

    Ive run into similar situations before with modbus device.
    Make sure your data source has Use multiple write commands only checked.
    Modbus function 16 writes to holding registers
    Use a 4 byte unsigned int.
    I believe the decimal number would be 166774:
    0_1595311234142_Screenshot 2020-07-21 at 08.00.25.png
    Turn on the log I/O of the data source so you can inspect the modbus commands.
    There may be a chance you might need to use a 4 byte unsigned int swapped

    If you dont come right paste your I/O commands here.

  • Hi Craig, I've definitely got multiple writes selected in the data source.

    I might have to re-visit the calculator / converter looking at that number. I was just sending it the raw hex value.

    I'll give it a go. Thanks :)

  • Hey Dan

    Did a quick tet for you. I believe it is correct checkout the snapshot I took from Wireshark:
    0_1595326095916_Screenshot 2020-07-21 at 12.07.11.png

    Something to note about modbus is that sometime in manuals they will prefix the register number with the register type. Holding register is decimal 4. So when you see that on a manual you will just put offset 104 in mango. You will also see that some manual are 0 based and some are 1 based. So you might need to try 103 instead of 104.
    Below is the settings I used for my point. I used decimal 166774
    0_1595326337152_Screenshot 2020-07-21 at 12.12.05.png