• 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

    Invalid slave id

    Modbus4J general discussion
    6
    11
    9.3k
    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.
    • H
      HenryDUT
      last edited by

      Hi, I want to specify the value of slave id , but when I execute the following code, I get an exception "com.serotonin.modbus4j.exception.ModbusTransportException: Invalid slave id".

      If slave id is less than 248?it will be OK.

      Is there a problem with the code? or slave id can not be greater than 247 ?

      int slave_id=255;
      ModbusRequest req = new ReadInputRegistersRequest(slave_id, 0, 5);
      ReadInputRegistersResponse rep = (ReadInputRegistersResponse) mp.send(req);

      Thanks

      1 Reply Last reply Reply Quote 0
      • F
        fmunhoz
        last edited by

        As I recall Modbus only has an 8-bit address, so one master can only talk to 255 slaves via 1 port, so valid addresses are in the range 0..247 where 0 is used as a broadcast address.

        However you can use another port, though.

        If have any doubts about it I recommend you google for modbus documentation.

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

          Actually, max slave id is 240.

          Best regards,
          Matthew

          1 Reply Last reply Reply Quote 0
          • H
            HenryDUT
            last edited by

            Thanks for fmunhoz's recommendation.

            In MODBUS Messaging on TCP/IP Implementation Guide, it says that

            On TCP/IP, the MODBUS server is addressed using its IP address; therefore, the MODBUS Unit Identifier is useless. The value 0xFF has to be used.

            When addressing a MODBUS server connected directly to a TCP/IP network, it’s recommended not using a significant MODBUS slave address in the “Unit Identifier” field. 0xFF is recommended for the “Unit Identifier" as non-significant value.

            But 0xFF is greater than 247 (decimal), how can I assign 0xFF to the slave device address?

            1 Reply Last reply Reply Quote 0
            • H
              HenryDUT
              last edited by

              @mlohbihler said:

              Actually, max slave id is 240.

              really?

              Is it not assigned from 1 to 247 (decimal) ?

              1 Reply Last reply Reply Quote 0
              • H
                HenryDUT
                last edited by

                @HenryDUT said:

                Thanks for fmunhoz's recommendation.

                In MODBUS Messaging on TCP/IP Implementation Guide, it says that

                On TCP/IP, the MODBUS server is addressed using its IP address; therefore, the MODBUS Unit Identifier is useless. The value 0xFF has to be used.

                When addressing a MODBUS server connected directly to a TCP/IP network, it’s recommended not using a significant MODBUS slave address in the “Unit Identifier” field. 0xFF is recommended for the “Unit Identifier" as non-significant value.

                But 0xFF is greater than 247 (decimal), how can I assign 0xFF to the slave device address?

                Who can help me?

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

                  Is the slave id actually causing problems for you?

                  Best regards,
                  Matthew

                  1 Reply Last reply Reply Quote 0
                  • V
                    villadaniel_750
                    last edited by

                    Amazing. Here i have PLC General Electric F650, with slave Modbus TCP and the slave id is 254 (HEX FE). Great job Modbus4J assuming a slave id between 0 to 247. JAR to TRASH

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

                      I will refer you to the protocol specification.
                      http://modbus.org/docs/PI_MBUS_300.pdf

                      Page 19 (#10) is probably the page you'd be interested in, first paragraph. Some people suggest there are extra functions mapped onto units addressed 248-255, but I can't find a spec for that.

                      http://www.modbus.org/docs/Modbus_over_serial_line_V1.pdf
                      page 8

                      http://www.modbus.org/docs/Modbus_Messaging_Implementation_Guide_V1_0b.pdf
                      page 23

                      1 Reply Last reply Reply Quote 0
                      • C
                        craig
                        last edited by

                        villadaniel_, since it is a PLC why don't you change its slave id to something in the range that will work?

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