final public boolean [ ] readDiscreteInputs ( int serverAddress , int startAddress , int quantity ) throws ModbusProtocolException , ModbusNumberException , ModbusIOException { ModbusRequest request = ModbusRequestBuilder . getInstance ( ) . buildReadDiscreteInputs ( serverAddress , startAddress , quantity ) ; ReadDiscreteInputsResponse response = ( ReadDiscreteInputsResponse ) processRequest ( request ) ; return response . getCoils ( ) ; }
This function code is used to read from 1 to 2000 contiguous status of discrete inputs in a remote device . The Request PDU specifies the starting address i . e . the address of the first input specified and the number of inputs . In the PDU Discrete Inputs are addressed starting at zero . Therefore Discrete inputs numbered 1 - 16 are addressed as 0 - 15 . If the returned input quantity is not a multiple of eight the remaining inputs in the final boolean array will be padded with FALSE .