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.
The read is timiing out
-
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: 40This 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!