100% found this document useful (1 vote)
118 views31 pages

Inter-Integrated Circuit (I C) Bus

This document provides an overview of Inter-Integrated Circuit (I2C) bus protocol. I2C is a synchronous, bidirectional communication protocol used to connect devices like microcontrollers and sensors. It uses just two bidirectional open-drain lines: serial data line (SDA) and serial clock line (SCL). The document describes I2C specifications, signals, addressing, arbitration, and how to interface I2C with a PIC microcontroller by configuring registers to write and read from an EEPROM memory device. Example code is provided.

Uploaded by

Ranjith Raj
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
118 views31 pages

Inter-Integrated Circuit (I C) Bus

This document provides an overview of Inter-Integrated Circuit (I2C) bus protocol. I2C is a synchronous, bidirectional communication protocol used to connect devices like microcontrollers and sensors. It uses just two bidirectional open-drain lines: serial data line (SDA) and serial clock line (SCL). The document describes I2C specifications, signals, addressing, arbitration, and how to interface I2C with a PIC microcontroller by configuring registers to write and read from an EEPROM memory device. Example code is provided.

Uploaded by

Ranjith Raj
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Inter-Integrated Circuit(IC)Bus

Covered Topics
Overview of I2C Using I2C on the PICmicro Microcontroller Example: A code walk-though for connecting a EEPROM to a PIC16 Microcontroller

Overview of I2C
Used for moving data simply and quickly from one device to another Serial Interface Synchronous Bidirectional

Overview of I2C
I2C is a Synchronous protocol The data is clocked along the clock signa(SCL) The clock signal controls when data is changed and when it should be read I2C is a Bidirectional protocol Data is sent either direction on the serial data line (SDA) by the master or slave.

Overview of I2C
I2C is a Master-Slave protocol The Master device controls the clock (SCL) The slave devices may hold the clock low to prevent data transfer No data is transferred unless a clock signal is present All slaves are controlled by the master clock

Overview of I2C Signals


I2C is a Serial Interface of only two signals: SDA Serial DAta This line transfers data to or from the master. SCL Serial CLock This controls when data is sent and when it is read. The master controls SCK.

I2C Supporting Speeds


Operates up to 100 kbit/s in the Standardmode, up to 400 kbit/s in the Fast-mode, and up to 3.4 Mbit/s in the High-speed mode

I2C- Signals

I2C- Pull up Resistor

I2C- Elements
Building Blocks of I2C

sS

Data

S= Start P= Stop R= Restart A= Ack

I2C Elements Start Condition

I2C Elements Stop Condition

I2C Elements -Restart Condition

I2C Elements- Data

I2C Elements- Data

I2C Elements- ACK

I2C Elements- Nack

I2C Addressing

I2C Interfacing

I2C Arbitration
If two or more masters try to put information to the bus, the first to produce a one when the other produces a zero will lose the arbitration. Arbitration can continue for many bits. Its first stage is comparison of the address If the masters are each trying to address the same device arbitration continues with comparison of the data. Because address and data information on the I2C-bus is used for arbitration, no information is lost during this process.

Writing to a I2C EEPROM

Reading from an I2C EEPROM

Writing to a Larger EEPROM

I2C in the PIC micro MCU


Registers control the function I2C in the PIC micro microcontroller The values to be placed in the registers will often depend on the application

SSPCON Register
SSPCON Register: WCOL Write Collision SSPOV Overflow SSPEN Enable SSPM3:SSPM0 (4 bits) Function Control CKP is also in SSPCON but is not used for master mode I2C.

SSPCON2 Register
GCEN General Call Enable ACKSTAT ACK Bit Status ACKDT ACK Transmit Data ACKEN ACK Transmit Enable RCEN Receive Enable PEN Stop Condition Enable RSEN Restart Condition Enable SEN Start Condition Enable

SSPSTAT Register
SMP Slew Rate Control CKE Signal Level Control BF Buffer full

SSPADD Register
The SSPADD register controls the speed of the I2C bus transmissions. It controls the baud rate generator.

I2C -- Code Example -Write

I2C -- Code Example - Read

Reference
Application Notes AN734, AN735 and AN578 from Microchip

You might also like