Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By YV1HX
#58777
martinayotte wrote:I think you didn't saw my previous answer : all 24C02/24C04/24C08/24C16 use 8 bits addressing instead of 16 bits addressing. [...snip...]


Actually I see and answer your post, but for some reason my message never got the board.

martinayotte wrote:[...snip...]Either use a different library that support it, [...snip...]

I'm working on that ;)

martinayotte wrote:[...snip...] or unsolder the chip and resolder 24C32 and higher.

My circuit is wired in a protoboard, the simple reason for using this particular device right now is because I have a couple of parts readily available in my parts drawer.

I will keep you posted.
User avatar
By 21h
#68037 oh god ) just make following changes:

unsigned int to uint8_t

Code: Select all// EEPROM definitions
unsigned int EEPROMBank = 0x50;                 // Base address of 1st EEPROM chip
uint8_t EEPROMAddress = 0;                 // Sets the start EEPROM address
unsigned int EEPROMValue = 0;                   // EEPROM value
byte Dummy;


comment out few lines and add line for 8 bit address:

Code: Select alloid writeEEPROM(int deviceaddress, unsigned int eeaddress, byte data ) {
  Wire.beginTransmission(deviceaddress);
  //Wire.write((int)(eeaddress >> 8));   // MSB
  //Wire.write((int)(eeaddress & 0xFF)); // LSB
  Wire.write((int)(eeaddress));
  Wire.write(data);
  Wire.endTransmission();
  delay(5);
}
/////////////////////////////////////////////////////////////////////////////////////////
byte readEEPROM(int deviceaddress, unsigned int eeaddress ) {
  byte rdata = 0xFF;
  Wire.beginTransmission(deviceaddress);
  //Wire.write((int)(eeaddress >> 8));   // MSB
  //Wire.write((int)(eeaddress & 0xFF)); // LSB
  Wire.write((int)(eeaddress));
  Wire.endTransmission();
  Wire.requestFrom(deviceaddress,1);
  if (Wire.available()) rdata = Wire.read();
  return rdata;
}



result:

Code: Select all=============================
EEPROMAddress: 0, EEPROMValue: 124, EEPROMBank: 0x50
EEPROMAddress: 0, Value: 124
EEPROMAddress: 1, Value: 123
EEPROMAddress: 2, Value: 255