• Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. jmbsps

    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
    J
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 3
    • Best 0
    • Controversial 0
    • Groups 0

    jmbsps

    @jmbsps

    0
    Reputation
    505
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    jmbsps Unfollow Follow

    Latest posts made by jmbsps

    • RE: Handling of IEC 61131-3 data type BYTE

      Hello,

      so far getting byte values is working but I'd like some opinions on the byte order.

      Should byte 0 be the LSB or MSB?

      Modbus being big-endian the first byte in the register (register is a 16-bit word) is the MSB. The second is the LSB.
      But in my PLC when I configure the variables the first byte value at a given address is the LSB, the second the MSB.

      To summarize:

      PLC configuration
      BYTE first AT %QB616
      BYTE second AT %QB617

      MODBUS register 308 (word value)
      second | first

      modbus4j
      should this be
      batchRead.addLocator("second", slaveId, RegisterRange.INPUT_REGISTER, 308, DataType.BYTE, (byte) 0);
      batchRead.addLocator("first", slaveId, RegisterRange.INPUT_REGISTER, 308, DataType.BYTE, (byte) 1);
      or
      batchRead.addLocator("first", slaveId, RegisterRange.INPUT_REGISTER, 308, DataType.BYTE, (byte) 0);
      batchRead.addLocator("second", slaveId, RegisterRange.INPUT_REGISTER, 308, DataType.BYTE, (byte) 1);

      I would prefer the latter.

      Regards
      jmbsps

      posted in Modbus4J general discussion
      J
      jmbsps
    • Handling of IEC 61131-3 data type BYTE

      Hello,

      thanks for providing modbus4j as free software.
      Recently I started using modbus4j in a little project feeding some data from our house into rrdtool for long term visualisation.

      I was wondering how to handle the IEC 61131-3 data type BYTE which is defined as an 8-bit bit string.
      There is no 8-bit data type in modbus4j.

      I know that Modbus only defines single bit or register (16-bit) operations. On the slave I can define 8-bit BYTE values and it would be great if there would be a convenience method retrieving it.

      Something like the convenience methods for retrieving bit values.

      batchRead.addLocator("FirstByteValue", slaveId, RegisterRange.INPUT_REGISTER, 256, DataType.BYTE, (byte) 0); //retrieves first byte from register 256
      batchRead.addLocator("SecondByteValue", slaveId, RegisterRange.INPUT_REGISTER, 256, DataType.BYTE, (byte) 1); //retrieves second byte from register 256

      I planned on hacking this into my own modified version of modbus4j.
      My plan is to define this as java primitive short since BYTE in IEC 61131-3 is unsigned and there is no unsigned 8-bit value in java.

      Is this something of general interest? Since modbus4j is free software I'd like to offer my modifications back to the project.

      Regards
      jmbsps

      posted in Modbus4J general discussion
      J
      jmbsps
    • RE: Handling of IEC 61131-3 data type BYTE

      Hello,

      thanks for providing modbus4j as free software.
      Recently I started using modbus4j in a little project feeding some data from our house into rrdtool for long term visualisation.

      I was wondering how to handle the IEC 61131-3 data type BYTE which is defined as an 8-bit bit string.
      There is no 8-bit data type in modbus4j.

      I know that Modbus only defines single bit or register (16-bit) operations. On the slave I can define 8-bit BYTE values and it would be great if there would be a convenience method retrieving it.

      Something like the convenience methods for retrieving bit values.

      batchRead.addLocator("FirstByteValue", slaveId, RegisterRange.INPUT_REGISTER, 256, DataType.BYTE, (byte) 0); //retrieves first byte from register 256
      batchRead.addLocator("SecondByteValue", slaveId, RegisterRange.INPUT_REGISTER, 256, DataType.BYTE, (byte) 1); //retrieves second byte from register 256

      I planned on hacking this into my own modified version of modbus4j.
      My plan is to define this as java primitive short since BYTE in IEC 61131-3 is unsigned and there is no unsigned 8-bit value in java.

      Is this something of general interest? Since modbus4j is free software I'd like to offer my modifications back to the project.

      Regards
      jmbsps

      posted in Modbus4J general discussion
      J
      jmbsps