• 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

    Problem with reading 8 byte unsigned modbus data

    Mango Automation general Discussion
    2
    4
    1.5k
    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.
    • M
      malcolmbco
      last edited by

      I am reading an 8 byte modbus parameters and it seems to be returning the least significant byte as a zero. Has anyone else had this issue?

      1 Reply Last reply Reply Quote 0
      • phildunlapP
        phildunlap
        last edited by phildunlap

        It's only zero'ing a byte, not a register? Here's the code that would be doing the transformation from the byte array over the wire to a number for the consumer: https://github.com/infiniteautomation/modbus4j/blob/master/Modbus4J/src/com/serotonin/modbus4j/locator/NumericLocator.java

        If you actually mean the register (two bytes) then I would wonder if you documentation is 1-indexed and your offsets need to be shifted by 1 as Mango is 0-indexed.

        If you do indeed mean a single byte, then I wonder if that was something bizarre with the device.

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

          If I simply read the registers from the device, I get back what I expect. If I split the read into two 4 byte unsigned reads, then the data is correct in each part. I actually wrote the device code and am sure it works as intended.
          One more question: Is it possible to access the actual array of bytes read from the device if the point data is set to a fixed length string?
          This would really simplify my script processing of special data types.

          Thanks!

          Malcolm

          1 Reply Last reply Reply Quote 0
          • phildunlapP
            phildunlap
            last edited by phildunlap

            Hmm. Well, I'll think about it more but I'm fairly confident Modbus4J handles it properly.

            Yeah you should be able to unpack the string the same way you packed it.

            Edit: My recommendation, to prove what you're saying, would be to disable all the points on your modbus data source, the enable IO logging and the two points as 4 byte variants. Do the read, disable the points. Enable the 8 byte single point, do a read. Post the resultant IO log.

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