public void readData(DataInput din) throws IOException {
    setByteCount(din.readUnsignedByte());

    InputRegister[] registers = new InputRegister[getWordCount()];
    ProcessImageFactory pimf = ModbusCoupler.getReference().getProcessImageFactory();
    for (int k = 0; k < getWordCount(); k++) {
      registers[k] = pimf.createInputRegister(din.readByte(), din.readByte());
    }
    m_Registers = registers;
    // update data length
    setDataLength(getByteCount() + 1);
  } // readData
  public void readData(DataInput din) throws IOException {

    m_Reference = din.readShort();
    // read lengths
    int wc = din.readUnsignedShort();
    int bc = din.readUnsignedByte();

    // read values
    if (m_NonWordDataHandler == null) {
      m_Registers = new Register[wc];
      ProcessImageFactory pimf = ModbusCoupler.getReference().getProcessImageFactory();
      for (int i = 0; i < wc; i++) {
        m_Registers[i] = pimf.createRegister(din.readByte(), din.readByte());
      }
    } else {
      m_NonWordDataHandler.readData(din, m_Reference, wc);
    }
  } // readData