steveohara / j2mod

Enhanced Modbus library implemented in the Java programming language
Apache License 2.0
269 stars 111 forks source link

My RS485 can only send, but not receive. #134

Closed Conmi-WhiteJoker closed 1 year ago

Conmi-WhiteJoker commented 1 year ago

Expected Behavior

Can read and write

Actual Behavior

Only write, not read. In fact, other RS485 tools can listen for the returned content, but the program itself does not receive the information.

Error info: com.ghgande.j2mod.modbus.ModbusIOException: I/O failed to write at com.ghgande.j2mod.modbus.io.ModbusRTUTransport.writeMessageOut(ModbusRTUTransport.java:278) at com.ghgande.j2mod.modbus.io.ModbusSerialTransport.writeMessage(ModbusSerialTransport.java:109) at com.ghgande.j2mod.modbus.io.ModbusSerialTransport.writeRequest(ModbusSerialTransport.java:96) at com.ghgande.j2mod.modbus.io.ModbusSerialTransaction.execute(ModbusSerialTransaction.java:135) at com.ghgande.j2mod.modbus.facade.AbstractModbusMaster.readMultipleRegisters(AbstractModbusMaster.java:237)

Steps to Reproduce the Problem

serialParameters.setEncoding(Modbus.SERIAL_ENCODING_RTU); serialParameters.setEcho(true); serialParameters.setRs485Mode(true);

Specifications

Conmi-WhiteJoker commented 1 year ago

Solve, Sending must be set to "Odd"