Have a look to the PBP manual.

Have a look to this code from Melabs website

and much on this forum.. search for I2CREAD and I2CWRITE