I have written the following program to understand how to use JAMOD to access coils. Unfortunately it is throwing the error -

java.lang.IndexOutOfBoundsException
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.DataInputStream.read(Unknown Source)
at net.wimpi.modbus.io.ModbusTCPTransport.readResponse(ModbusTCPTransport.java:177)
at net.wimpi.modbus.io.ModbusTCPTransaction.execute(ModbusTCPTransaction.java:193)
at TempReader.main(TempReader.java:27)
. x2 more times
.
java.io.EOFException
at java.io.DataInputStream.readUnsignedByte(Unknown Source)
at net.wimpi.modbus.io.BytesInputStream.readUnsignedByte(BytesInputStream.java:153)
at net.wimpi.modbus.io.ModbusTCPTransport.readResponse(ModbusTCPTransport.java:182)
at net.wimpi.modbus.io.ModbusTCPTransaction.execute(ModbusTCPTransaction.java:193)
at TempReader.main(TempReader.java:30)
net.wimpi.modbus.ModbusIOException: Executing transaction failed (tried 3 times)
at net.wimpi.modbus.io.ModbusTCPTransaction.execute(ModbusTCPTransaction.java:197)
at TempReader.main(TempReader.java:30)

In the program line 27 is "trans.execute()". The coil address I am trying to read is 0x7D1 (2001) or channel 0 Data type is 2 word. -

yes i'm triing with this slave and your master and it stop with error code 2
–
DavidSep 3 '13 at 11:45

Hi @ISCI. How can i use it in android without passing IPParameters? Actually, I want to pass Arduino Bluetooth MAC address and read ModBus Data from it which is constantly generated. I am done with bluetooth Pairing with my Android phone and Arduino Bluetooth Device. But can't read ModBus Data from Arduino Bluetooth Device. Please give me some tutorial/sample code. Thanks in Advance.
–
Dhruv VaishnavSep 4 '13 at 11:07