• 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

    The read is timiing out

    Modbus4J general discussion
    1
    2
    1.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.
    • H
      hocragekey
      last edited by

      Here is the code for the following info we need to pull

      ModbusFactory factory = new ModbusFactory();
      IpParameters params = new IpParameters();
      params.setHost("192.168.1.100");
      params.setPort(502);
      params.setEncapsulated(true);
      ModbusMaster master = factory.createTcpMaster(params, false);
      // master.setRetries(4);
      master.setTimeout(50000);
      master.setRetries(5);

      		long start = System.currentTimeMillis();
      		try {
      			master.init();
      			for (int i = 0; i < 40; i++) {
      				System.out.println(master.getValue(100,
      						RegisterRange.COIL_STATUS, 100+i,
      						DataType.BINARY));
      			}
      		} catch (Exception e) {
      			e.printStackTrace();
      		} finally {
      			master.destroy();
      		}
      
      		System.out.println("Took: " + (System.currentTimeMillis() - start)
      				+ "ms");
      

      We are trying to pull the values from the following information

      Slave ID: 100
      Function: 01 Read Coils (0x)
      Address: 100
      Quantity: 40

      This works on another program we downloaded just to see if the PLC was ok and the PLC is working. Whenever we try with Modbus4j it times out. Any help is appreciated!

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