I2C In 8051

I2C/TWI is a half duplex serial transmission.

  • The data transfer rate depends on crystal frequency of slave controller.
  • I2C is a Multi-point protocol in which a maximum up-to 128 peripheral devices can be connected to communicate along the serial interface.
  • Two wire interface protocol uses only two wire for data communication.
  • The serial data transmission is done in asynchronous mode.
  • The two bidirectional open drain lines named SDA (Serial Data) and SCL (Serial Clock).
  • Communication takes place between two are more devices.
  • One of the two devices act as a master and other act as a slave.
  • The ACK (acknowledgement) signal is sent/received from both the sides.
  • It uses two wire they are SCL and SDA. SCL=Clock line, SDA=Data line.
  • SCL is the clock line bus used for synchronization and is controlled by the master.
  • SDA is known as the data transfer bus.
  • The master controls the two buses and slave always responds to the masters queries.
  • There can be multi master or single master mode of communication.
  • Data transfer initiated with start bit (s) and stop it with stop bit (P).
  • When SDA drop at the middle of the clock SCL that is start condition.
  • When SDA raise at the middle of the clock SCL that is stop condition.


  • At start condition master send seven bit slave address and then by a data direction bits.
  • Data direction is also know as Read /Write control bit.
  • When the Data direction bit is logic zero, the master performs write operation.
  • When the Data direction bit is logic one, the master performs read operation.
  • If a particular slave device is addressed, the slave acknowledges to master by holding SDA low for one clock cycle.
  • If the data transmission is completed, the Stop Condition is issued by master to stop the communication.
  • The master or slave transmits the data (8-bit data) on SDA pin,it depends on the data direction bit (r/w bit).
  • Receiving device then acknowledges the data. The acknowledgement signal updates the status register.
  • Data transmission is completed the Stop Condition issued by master to stop the communication.