Blogger Themes

Search This Blog

www.embeddedstudy.com | Copyright © 2017 | All Rights Reserved | Nithin Pradeep . Theme images by Storman. Powered by Blogger.

Follow by Email

Popular KOZHI

Sponsor

Download

Blogger Tricks

FEATURED

What is an Embedded System?

An embedded system is a combination of hardware and software that is designed to carry out a certain task or tasks, meaning it has a s...

JOIN THE TEAM

Popular Posts

Wikipedia

Search results

Search This Blog

Social

More Links

Social

ad

ads

Friday, 18 August 2017

I²C PROTOCOL-Read & Write frame



Each I2c compatible device comes with a predefined address.
Device address can be 7 bit or 10 bit.Device address is availabe in Data sheet.
There is no voltage conversion in I2C unlike UART uses TTL logic only.
I2C is  an acknowledgement based Protocol.

Device speed

I²C device Minimum speed is 100 kbps and maximum 3.4 MBps.
if master is using
-100kbps it is called Standard speed mode
-400kbps it is called Fast speed mode
-1 MBps it is called Fast speed plus mode
-3.4 MBps it is called Hish speed mode

Byte Format and Byte Order
Every byte put on SDA must be strictly 8bit long,Data is transferred from MSB to LSB.


We cannot connect 2 slaves with same device address on I2C bus.



Standard Write Frame(1 Byte)

Standard ReadFrame(1 Byte)


For reading I2C first we have to dummy write this is for checking whether device address is valid or not.

I2C Bus Events

  • Start Condition
  • Stop Condition
  • Write
  • Read
  • Acknowledgement condition
  • No Acknowledgement condition
When master and slave are not communicating with each other the the bus is treated as idle ie. HIGH
I2C Start and Stop Condition

A high to low transition on the SDA line while SCL is high is reffered to as Starting Condition.
A  low to high transition on the SDA line while SCL is high is reffered to as Stop Condition.

This is shown in the diagram below.

Protocol Implementation

There are two methods to implement Protocols
  1. Bit Banging Method.
  2. Peripheral Method.
Peripheral method is preferable since it has inbuilt protocol implementation logic in Micro controller.

If inbuilt I2C is not available ie no SDA or SCL lines we go for Bit Banging method for example 8051.
Bit Banging increases complexity in circuit and also correctness will be less.
Any I/O pins of the device can be connected to I2C device.The main disadvantage of using this method is that we cannot set the communication speed.

I have an 8051 development board with me, so here i am going to use bit banging method.

Use these header files in  your Program for I2C Bit banging logic,I have done using KEIL IDE.

Download

I²C.h
I²C_device.h

check this sample program also to write string "NITHIN" to EEPROM - AT24C08 and then fetching it and printing on  LCD

ASSIGNMENTS

* Write a Program to enter a character and enter a memory loacation and copy that character to that memory location.  

In the next section we will see How to interface I2C devices Like AT24C08 (EEPROM) and DS1307(Real Time Clock) with 8051...


<< Previous                                                                                                                                                                 Next>>


0 on: "I²C PROTOCOL-Read & Write frame"