public void write_single(short address, short msg) throws IOException {
      if ((this.mode==0) || (this.mode==SET_MODE_I2C_SERIAL)) this.set_mode(SET_MODE_I2C_100);
      byte[] data=new byte[3];
      data[0]=(byte)RW_SINGLE;
      data[1]=(byte)address;
      data[2]=(byte)msg;
      byte[] result = this.sendAndReceive(data, COM_TIMEOUT, 1);
      if (result.length==0) throw new IOException("no answer from device");
      if (result[0]!=0) throw new IOException("device error: "+result[0]);
    }