How to read 24Cxx I2C Eprom bigger than 2Kb (ie 4kb)

the link I gave you says:

" There can be multiple 24LCXX chips on the same I2C bus, as long as their A0, A1, and A2 address pins are set to different values. For example, two 24LC256 chips can be used to provide the same memory capacity as a single 24LC512 chip. The optional bank parameter to the constructor is used to assign different bank addresses to each chip:

SoftI2C i2c(A4, A5);
EEPROM24 eeprom0(i2c, EEPROM_24LC256, 0);
EEPROM24 eeprom1(i2c, EEPROM_24LC256, 1); "

this is all you need to communicate with any 24Cxxx EEPROM. Just replace the part saying "EEPROM_20LC04" with your spesifil EEPROM type. (You will have write LC instead of C, because this library was originally designed for microchip's i2c EEPROMs. However, the library should support all kinds of eeproms starting with 24.

EDIT:
Forgive me, you cant run two EEPROMS at the same address, but you can, like I mentioned, make two EEPROMS act as twice as large EEPROM

#include "EEPROM24.h"

 SoftI2C i2c(SDA, SCL); //(A4,A5);
 EEPROM24 eeprom(i2c, EEPROM_24LC04,0x50);
 
byte value;
int address = 0;

void setup() {
Serial.begin(9600); 
}

 void loop() { 
  value = eeprom.read(address);
  
  Serial.print(address);
  Serial.print("\t");
  Serial.print(value, DEC);
  Serial.println();
  
  // advance to the next address of the EEPROM
  address = address + 1;
  
  // there are only 512 bytes of EEPROM, from 0 to 511, so if we're
  // on address 512, wrap around to address 0
  if (address == 128){
    address = 0; }
    
  delay(500);
    
 }

The download page doesn't have a dowload link, so you will have to copy the source code on the page. If you want I can upload the library for you :slight_smile:

1 Like