Inter-Integrated Circuit (I C) Bus
Inter-Integrated Circuit (I C) 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
I2C- Signals
I2C- Elements
Building Blocks of I2C
sS
Data
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.
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.
Reference
Application Notes AN734, AN735 and AN578 from Microchip