Hi, I'm new in this, I need help to define 24c64 and 24c256 in the same sketch I use the library #include <EEPROM24.h> #include <I2CMaster.h> #include <SoftI2C.h>
SoftI2C i2c(10,11); // SDA=10, SCL=11........
the error is here I can not select one of the two can be defined with sw?
if (pina==1)EEPROM24 eeprom(i2c,EEPROM_24LC64);
if (pinb==0)EEPROM24 eeprom(i2c,EEPROM_24LC256);
Thanks for answering
I do not know if I can upload the entire code because it is not mine, I just want to modify it to be able to use it with different eeprom.
I'm using arduino nano
the code works only that I do not know how to use the i2c library that is from elektor-magazine I do not know if it breaks any rule of the forum this is the link of the project
What I want to do is use a pin as switch to change from 24c64 to 24c256
Can I change ic eeprom while another is initialized?
I already asked the one who did the project but he does not answer
Do you want to opertae 24C64 and 24C256 EEPROMs simultaneously? To do it, you assign address 0x50 (1010A2A1A0 = 1010000) for 24C256 and address 0x57 (1010A2A1A0 = 1010111) for 24C64. Now, the chips have different I2C Bus addresses and you can very well perform data read/write operations.
Sample codes:
#include<Wire.h>
void setup()
{
Serial.begin(9600);
Wire.beginTransmission(0x50); //accessing 24C256
Wire.write(0x12); //upper byte of location address 0x1234
Wire.write(0x34); //lower byte of location address 0x1234
Wire.write(0x57); //data for location 0x1234;
Wire.endTransmission();
delay(5); //must wait for 5 ms as it is write cycle time
}
Wire.beginTransmission(0x50); //accessing 24C256
Wire.write(0x12); //upper byte of location address 0x1234
Wire.write(0x34); //lower byte of location address 0x1234
Wire.endTransmission();
Wire.requestFrom(0x50, 1); //command to read data from location 0x1234
byte x = Wire.read(); //data in x
Serial,print(x, HEX); //serial monitor should show 57
//=== repeat the aboce code for 24C64 EPROM at I2C address 0x57 and data location 0x1278.
}
void loop()
{
}