Class ModbusWriteRegisterRequestBlueprint


  • @NonNullByDefault
    public class ModbusWriteRegisterRequestBlueprint
    extends ModbusWriteRequestBlueprint
    Implementation for writing registers
    Author:
    Sami Salonen - Initial contribution
    • Constructor Detail

      • ModbusWriteRegisterRequestBlueprint

        public ModbusWriteRegisterRequestBlueprint​(int slaveId,
                                                   int reference,
                                                   ModbusRegisterArray registers,
                                                   boolean writeMultiple,
                                                   int maxTries)
                                            throws IllegalArgumentException
        Construct coil write request with many bits of data
        Parameters:
        slaveId - slave id to write to
        reference - reference address
        registers - register(s) to write
        writeMultiple - whether to use ModbusWriteFunctionCode.WRITE_MULTIPLE_COILS over ModbusWriteFunctionCode.WRITE_COIL. Useful with single register of data.
        maxTries - maximum number of tries in case of errors, should be at least 1
        Throws:
        IllegalArgumentException - in case data is empty, writeMultiple is false but there are many registers to write.