I2C

I2C stands for Inter Integrated Circuit. It is one of the most widely used communication protocols used in embedded systems. I2C is most commonly used in a circuit itself hence named inter integrated circuit. 

What is I2C
It was invented by philips.It is a two line synchronous communication protocol. Transmitter and receiver sharing a common clock is known as synchronous. In I2C only two lines are used to interface the transmitter and receiver. The two lines are SDA , SCL . The device which gives the clock is known as master , and the other device is known as slave. In short Master is the device that has control over other devices.
SCL – Serial Clock : This is the clock line given to slave/s from master.
SDA – Serial Data : This is a bidirectional bus where data transmission occurs.

I2C is useful when there are multiple devices on a chip. In I2C interface multiple slaves and multiple masters can be interfaced using only 2 lines. 

Types of Interfaces:

  1. Master Slave Interface
  2. Single Master , Many Slaves
  3. Many Masters, Many Slaves.

Hardware implementation :

Data Transmission :

Data transfer in i2c protocol follow certain procedure
1. Start
2. Device Address
3. Control Signal ( Read/Write )
4. Acknowledgement
5. Data Transmission
6. Stop

Start:

Before data is transmitted, both the lines SDA and SCL are high. As the data should be transmitted SDA line goes zero, following it SCL lines goes zero. This indication states that it is the start bit.

i2c

Address ( target device ) :

Master should select the device to which data should be sent or received. In total 128 slaves can be interfaced with a single master. Only 2 lines are required to communicate with all these slaves. So a 7 bit address is given on the SDA line to select the slave. 

Control Signal:

In the previous part already 7 bits in a byte were utilized to select address, this last bit is used to select, whether the master wants to read the data or write the data. If R/W = 1, then it wants to read the data , if R/W = 0, then it wants to write the data. 

Acknowledgement:

If the Master wants to write the data, then till now R/W = 0. Then the slave will acknowledge the master , whether it is ready to receive the data or not. 

Data Transmission:

After the data transmission, the master acknowledges that the data is transmitted. 

Stop:

Once the total data is transmitted, both SCL and SDA will go high.

Advantages of I2C :

  1. It uses only 2 pins for communication.
  2. It can communicate with upto 128 devices.
  3. Addressing mode is inbuilt.
  4. It is ubiquitous. 

Disadvantages :

  1. It is half duplex. As it has only one data line, either it can receive or transmit data at a time. 
  2. Careful consideration of hardware due to pull up resistors.
  3. It is more complicated than SPI and UART. 

To know more about i2c, click here
Also read about 8051 Microcontroller

Spread knowledge

Leave a Comment

Your email address will not be published. Required fields are marked *