How do you write to a specific register using I2C communcation? I am trying to write to a charging IC (BQ24193) and I am trying to figure out how to use I2C to write to a specific register so I can set up the charging IC properly. I have watched a few videos on the communication protocol, but I don't understand how to write to a register directly. Your help would be appreciated. Thanks.

Datasheet: http://www.ti.com/lit/ds/symlink/bq24193.pdf
The Arduino uses the Wire.h library to communicate on an I2C bus.

Writing to a register in I2C is usually done by sending two bytes to the correct I2C address.  The first byte is usually the register address, and the second is the value to place into the register:

#define CHIP_ADDRESS     0x6B
#define REGISTER_ADDRESS 0x12

Wire.beginTransmission(CHIP_ADDRESS);
Wire.write(REGISTER_ADDRESS);
Wire.write(0x18);
Wire.endTransmission();


Reading from a register is slightly more tricky, in that first you need to write to the chip to set the register address, then as a separate operation you need to read from that address:

Wire.beginTransmission(CHIP_ADDRESS);
Wire.write(REGISTER_ADDRESS);
Wire.endTransmission();
Wire.requestFrom(CHIP_ADDRESS, 1); // We want one byte
uint8_t val = Wire.read();