• Recent
    • Tags
    • Popular
    • Register
    • Login

    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 support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    A Bit Stuck on Writing Multiple MODBUS Registers

    User help
    4
    44
    19.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • MattFoxM
      MattFox
      last edited by

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

      Do not follow where the path may lead; go instead where there is no path.
      And leave a trail - Muriel Strode

      1 Reply Last reply Reply Quote 0
      • danD
        dan
        last edited by

        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..

        0_1595286481588_b9c7913d-9d8b-478f-9775-86930d8dfaee-image.png

        1 Reply Last reply Reply Quote 0
        • MattFoxM
          MattFox
          last edited by

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

          35702

          I've entered it in like this since the values are a different length:
          0_1595287109290_eb9a056b-f56d-45ef-a15e-45e47614572e-image.png

          Do not follow where the path may lead; go instead where there is no path.
          And leave a trail - Muriel Strode

          1 Reply Last reply Reply Quote 0
          • danD
            dan
            last edited by

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

            1 Reply Last reply Reply Quote 0
            • danD
              dan
              last edited by

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

              1 Reply Last reply Reply Quote 0
              • MattFoxM
                MattFox
                last edited by

                That doesn't give you much to work with does it??
                0_1595288458427_0a3e4d6b-b8a8-4d6b-8b1d-9834705a4b87-image.png

                I got this working!

                Do not follow where the path may lead; go instead where there is no path.
                And leave a trail - Muriel Strode

                1 Reply Last reply Reply Quote 0
                • danD
                  dan
                  last edited by

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

                  Cheers for that hey.

                  1 Reply Last reply Reply Quote 0
                  • danD
                    dan
                    last edited by

                    FML...

                    0_1595288851390_73c615ec-36ee-4aab-9c39-7de2ee65a439-image.png

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

                    0_1595288918666_7ee37d3f-d806-4d64-9007-bc9a9ebe60b4-image.png

                    1 Reply Last reply Reply Quote 0
                    • MattFoxM
                      MattFox
                      last edited by MattFox

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

                      Do not follow where the path may lead; go instead where there is no path.
                      And leave a trail - Muriel Strode

                      1 Reply Last reply Reply Quote 0
                      • danD
                        dan
                        last edited by

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

                        1 Reply Last reply Reply Quote 0
                        • MattFoxM
                          MattFox
                          last edited by

                          write
                          4104
                          0
                          2
                          ASCII
                          0x8B76,0x8B76
                          That sets that control key and calls function 2

                          Do not follow where the path may lead; go instead where there is no path.
                          And leave a trail - Muriel Strode

                          1 Reply Last reply Reply Quote 0
                          • CraigWebC
                            CraigWeb
                            last edited by

                            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.

                            1 Reply Last reply Reply Quote 0
                            • danD
                              dan
                              last edited by

                              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 :)

                              1 Reply Last reply Reply Quote 0
                              • CraigWebC
                                CraigWeb
                                last edited by CraigWeb

                                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

                                1 Reply Last reply Reply Quote 0
                                • MattFoxM
                                  MattFox
                                  last edited by

                                  Ok, so I can understand using 166774 gives you 0x00028b76, basically just bit shifts the entire thing in. And that by using a holding register implicitly puts a 4 in the front so only 104 is needed... But if the manual states you need a control key into 8 and its 1's complement into register 9, shouldn't it be 0x8B768B76 = 2339801974 DEC?

                                  Fox

                                  Do not follow where the path may lead; go instead where there is no path.
                                  And leave a trail - Muriel Strode

                                  1 Reply Last reply Reply Quote 0
                                  • danD
                                    dan
                                    last edited by

                                    OK, now my brain is really hurting, I'll turn on the i/o log and see what mine is outputting.
                                    Just to clarify a little further, the MODBUS register I need to write to is on 'Page 16', the manual says to multiply 256 x Page then add the Offset, so in this case I'm on (256 x 16) + 8 = 4104
                                    When reading off battery voltages and other engine diagnostics off this the formula seems to work.
                                    I'll try again with the decimal.

                                    Cheers

                                    1 Reply Last reply Reply Quote 0
                                    • danD
                                      dan
                                      last edited by

                                      0_1595368234133_6f692b3b-5b32-4e53-8adc-08c5a7ab46a9-image.png
                                      0_1595368250040_9530b480-46fd-4685-869a-41c8aebbf8c0-image.png

                                      1 Reply Last reply Reply Quote 0
                                      • danD
                                        dan
                                        last edited by

                                        Interestingly, when I write the hex values I get this pop up error..
                                        0_1595368403070_8b8aefed-818b-4048-850e-4e56afa9c2a3-image.png
                                        Nothing written in the log during this time however :/
                                        0_1595368421016_04c99fc6-f9b1-47b1-9109-ffaa4b0fe395-image.png

                                        cwangvC 1 Reply Last reply Reply Quote 0
                                        • cwangvC
                                          cwangv @dan
                                          last edited by

                                          @dan
                                          just curious why the 'Number of registers' is '0'? shouldn't be at least '1'?

                                          1 Reply Last reply Reply Quote 0
                                          • MattFoxM
                                            MattFox
                                            last edited by

                                            It's greyed out and disabled.

                                            Do not follow where the path may lead; go instead where there is no path.
                                            And leave a trail - Muriel Strode

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post