digitalpetri / modbus

Modbus TCP, Modbus RTU/TCP, and Modbus RTU/Serial for Java 17+.
Eclipse Public License 2.0
653 stars 222 forks source link

How to set the slave address when sending a command #44

Closed liusishan closed 2 years ago

liusishan commented 2 years ago

Hello, how to modify the slave address when sending commands.

liusishan commented 2 years ago

Is it the unitId parameter of this method? I used the Modbus Slave simulation software to simulate a slave station, the address is 1, and the parameter unitId is the data obtained from slave station 1 no matter what value is passed.

public <T extends ModbusResponse> CompletableFuture<T> sendRequest(ModbusRequest request, int unitId) {
}
kevinherron commented 2 years ago

Yes, it’s the unitId parameter.