• 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

    WriteCoilsRequest

    Modbus4J general discussion
    2
    4
    2.9k
    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.
    • A
      andrex
      last edited by

      Hi,

      I'm Andrex
      (http://mango.serotoninsoftware.com/forum/posts/list/379.page#1831)

      after some test of tcp transport I found some unexpected exception while send more than 1016 coil values.

      After decompiling modbus4J.jar shipped with the version 1.8.2 of mango I found that line 60 of

      com.serotonin.modbus4j.msg.WriteCoilsRequest

      /* 60 */ this.data = new byte[ModbusUtils.popByte(queue)];

      is the origin of th exception.
      After changing the line to

      /* 60 */ this.data = new byte[ModbusUtils.popUnsignedByte(queue)];

      (using unsigned value) my test pass correctly.

      I dont know if the original row is incorrect or if my change is a good correction, but I hope to be helpful.

      Regards
      Andrea

      1 Reply Last reply Reply Quote 0
      • M
        mlohbihler
        last edited by

        Hi Andrea,

        Thanks for reporting this. You are correct, an unsigned byte should be popped at that point. I've made the fix in the code.

        Best regards,
        Matthew

        1 Reply Last reply Reply Quote 0
        • M
          mlohbihler
          last edited by

          Oh, also, i believe a similar change is required in WriteRegistersRequest at line 59:

                  data = new byte[ModbusUtils.popByte(queue)];
          

          ... should be:

                  data = new byte[ModbusUtils.popUnsignedByte(queue)];
          

          Best regards,
          Matthew

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