so can anyone explain the format on how can we implement this in I2C code.I'm using MikroC pro for PIC.
Make sure both the MCU and LED Display are properly configured in hardware / software. Look at section 8.1 in the LED datasheet, specific pins must be driven appropriately to configure the chip for I2C. See the MCU datasheet on how to configure the the I2C registers. You should set the clock frequency lower than 400 kHz as this is the maximum the LED supports (Table 13-6 in LED datasheet). Configure your MCU as the I2C Master.
Actual protocol. If you have the I2C library, this should be fairly straight forward. Otherwise, dig through the MCU datasheet / examples on how to do I2C communication. That's too expansive to cover in this post. If you are using the library, the commands are found here http://www.mikroe.com/mikroc/pic/libraries/
Looking at the diagram this is how we would procede
Issue a start command (This is the S at the beginning).
Write the slave address of the LED. The slave address is the "name" of the device on the I2C network. Note that there can potentially be many devices on a I2C line, which is why we need this "name". The name is formed of the upper 7 bits of the first byte. The slave address of the LED is “0111100” or 0x78 in hex. The lowest bit is a R/W or read/write bit. This tells the LED if we want to read or write to the device. In this case, we want to send a command so we want to write. Write is indicated by a 1. Thus the first byte that you should send is a 0x79.
All I2C transfers have a acknowledge bit, this will be returned by the I2C1_Wr function. It should be 0 to represent no errors.
Next we have a command byte. Send a repeated start over I2C using the library function to do so. The OLED has a set of commands that it exposes to the MCU. You can see these in section 9 of the LED datasheet. Pay close attention to section 8.9 of the datasheet, which describes how to turn on the LED. Notably you should send the command 0xAF to turn on the LED.
To write data to the device, look at the diagram labeled Control Byte in your figure. The top bit is labeled D/C indicating data or control byte. By setting this bit appropriate, the byte is processed as a data byte for display or a command byte.
Use the drivers from the following page. Written for pic18f2550 with mikroc compiler.