(Created page with "It is uses '''I²C''' ('''Inter-Integrated Circuit''') protocol, referred to as ''I-squared-C'', ''I-two-C'', or ''IIC'') for communication with the micrcontroller.Let see fir...")
 
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
It is uses '''I²C''' ('''Inter-Integrated Circuit''') protocol, referred to as ''I-squared-C'', ''I-two-C'', or ''IIC'') for communication with the micrcontroller.Let see first the basics of the communication protocol first.
+
[[Category:Embedded Basics]]
 +
 
 +
=Video Tutorial=
 +
{{#ev:youtube|22hwzv5wFTo|680}}
 +
=Introduction=
 +
The '''I²C''' ('''Inter-Integrated Circuit''') protocol, referred to as ''I-squared-C'', ''I-two-C'', or ''IIC'') is two wire serial communication protocol for connecting low speed peripherals to a micrcontroller or computer motherboard.
  
 
[[Image:I2C.png|thumb|350px|A sample schematic with one master and three slaves]]
 
[[Image:I2C.png|thumb|350px|A sample schematic with one master and three slaves]]
  
The '''I²C'''  require only two wires for communication. One is called the '''Serial Data (SDA)''' and the other is '''Serial Clock (SCL)''' as shown.
+
The '''I²C'''  simply require only two wires for communication. One is called the '''Serial Data (SDA)''' and the other is '''Serial Clock (SCL)''' as shown.
  
 
There are various modes and configurations in which it can be used. Let us start simply with a single master and a single slave.
 
There are various modes and configurations in which it can be used. Let us start simply with a single master and a single slave.
  
The Master generates the clock for serial communicaton
+
The Master generates the clock for serial communication('''SCL'''). A stream of data bits(B1 to BN) is transferred between the start and the stop bits.
 +
 
 +
=I2C Timings and Conditions.=
 +
Figure below shows the timing diagram for I²C.
 +
[[File:I2C data transfer.png|thumbnail|x100px|Fig: I2C data transfer]]
 +
 
 +
==Start Condition(S)==
 +
As seen from the timing diagram, a data transfer  is initiated with the '''Start(S)''' condition. The start occurs when '''SCL''' is high and '''SDA''' goes from high to low.
 +
 
 +
 
 +
==Data bits transfer(B1...Bn)==
 +
A bit is transmitted at every high level of the clock (SCL) after the start condition. As shown in the image bits '''B1''' to '''Bn''' are transmitted at high level of every successive clock cycles.
 +
 
 +
==Stop bit (P)==
 +
To stop the data transfer, the clock(SCL) is held high, while data(SDA) goes from low to high.
 +
 
 +
=Interfacing Microcontroller to I2C devices=
 +
Usually, following procedure is used to communicate with the peripherals.
 +
*Master initializes the communication by sending the slave address on the bus.
 +
*Master reads or writes data or commands from and to the slaves depending on the interfaced devices.
 +
 
 +
We will see practical implementation of I2C on different peripherals and Micrcontrollers. The examples will be updated here.
 +
=Practical Examples=
 +
*[[Interfacing_RTC_DS1307_with_8051]]
 +
 
 +
'''''Have a opinion, suggestion or feedback about this article, let it out here!'''''
 +
{{DISQUS}}

Latest revision as of 05:36, 15 December 2014


Video Tutorial

Introduction

The I²C (Inter-Integrated Circuit) protocol, referred to as I-squared-C, I-two-C, or IIC) is two wire serial communication protocol for connecting low speed peripherals to a micrcontroller or computer motherboard.

A sample schematic with one master and three slaves

The I²C simply require only two wires for communication. One is called the Serial Data (SDA) and the other is Serial Clock (SCL) as shown.

There are various modes and configurations in which it can be used. Let us start simply with a single master and a single slave.

The Master generates the clock for serial communication(SCL). A stream of data bits(B1 to BN) is transferred between the start and the stop bits.

I2C Timings and Conditions.

Figure below shows the timing diagram for I²C.

Fig: I2C data transfer

Start Condition(S)

As seen from the timing diagram, a data transfer is initiated with the Start(S) condition. The start occurs when SCL is high and SDA goes from high to low.


Data bits transfer(B1...Bn)

A bit is transmitted at every high level of the clock (SCL) after the start condition. As shown in the image bits B1 to Bn are transmitted at high level of every successive clock cycles.

Stop bit (P)

To stop the data transfer, the clock(SCL) is held high, while data(SDA) goes from low to high.

Interfacing Microcontroller to I2C devices

Usually, following procedure is used to communicate with the peripherals.

  • Master initializes the communication by sending the slave address on the bus.
  • Master reads or writes data or commands from and to the slaves depending on the interfaced devices.

We will see practical implementation of I2C on different peripherals and Micrcontrollers. The examples will be updated here.

Practical Examples

Have a opinion, suggestion or feedback about this article, let it out here!