How to Interface I2C External EEPROM 24LC64 to PIC Microcontroller

I2C External EEPROM

Microcontrollers are standalone chips since they have memory and processor embedded. The integrated memory of microcontrollers store embedded code and other temporary variables for the execution of program. CircuitsGallery published many microcontroller tutorials and PIC microcontroller projects. Sometimes we may use non-volatile memories (i2c devices) with microcontrollers in case of storing permanent data. In this article I am gonna explain how we interface an external memory i2c microchip with PIC microcontroller. For that I took Microchip’s 24LC64, which is a 64 Kbit Electrically Erasable PROM also called I2C. This i2c tutorial will definitely serve you while doing i2c projects.

I2C External EEPROM

LCD module is used to display the data. Program progresses by writing data to the 24LC64 i2c memory chip then reading it and displaying on LCD screen.

Schematics Diagram for Interfacing Microchip I2C EEPROM to PIC

Now let’s see the circuit diagram showing how to use i2c with PIC.

Components Required

  1. PIC 16F877 Microcontroller
  2. 24LC64 Memory chip (i2c datasheet)
  3. LCD Module
  4. Capacitors (33pF x 2)
  5. Crystal Oscillator 4MHz
  6. Resistor 10kΩ

How I2C Interface Works with PIC

  • 16×2 LCD it is connected on PORTB of PIC which shows the read and write operations to the viewer.
  • Here two wire interface (with SCL and SDA pins) is used for the communication between Memory device and PIC Microcontroller also called “I square C (I2C)” or “inter integrated circuit”

I2C External EEPROM

  • I2C has an advantage that can connect different device in same connection with the help of device address and start and stop signals.
  • In such interfacing, PIC acts as a master and I2C memory servers as slave then master and slave communicate each other. (There are situation where we use i2c master, but not here)
  • SCL (Serial Clock Line) is the clock line. It is used to synchronize all data transfers over the I2C bus and SDA (Serial DAta) is the data line.
  • To start communication the channel should be ideal (means it not used by other devices and it is free), in ideal stat both the pins SDA and SCL by applying high signal.

Write Operation

  • After sending the start signal PIC will send the device address with a write command for the EEPROM chip (i2c chip) is “0xA0”.
  • The next step is to send the registered address, which is the memory location where the data is to be written. (For low memory devices it can send by simple 8-bit).
  • Here we are using 64Kb memory so we have to send the registered address twice (I used 0x0000), this may send the registered address by two 8 bits.
  • After this send the data sequentially then send a stop signal.

Read Operation

  • To read from a specified address first send the device address with the write command.
  • Then send the registered address as two 8 bits.
  • A restart signal is sent (Here start signal is sent without sending a stop signal called a restart signal).
  • Then receive the data sequentially, The received data is stored on a buffer and is displayed on the screen.

Read more: How to Interface I2C External EEPROM 24LC64 to PIC Microcontroller

Leave a Comment

Your email address will not be published. Required fields are marked *