Hello can anybody help me,
I have solved the problem with the 24 LC512. Can you create a new block for large i2c EEPROMs like this example ?
many greetings
// ***** Example***
// This sketch read a eeprom (24c512) from address 0 to address 65535 decimal.
// This sketch is an output of ardublock, supplemented with two lines.
// Each memorycell being read individually, no page-mode!
// Output on the serial monitor.
// The devAddr is 80dec or 0x50Hex.
include
unsigned long _ABVAR_1_Counter = 0 ;
int _ABVAR_2_Value = 0 ;
boolean __ardublockIsI2cReadOk;
int __ardublockI2cReadData(int devAddr, unsigned long regAddr)
{
int data = 0;
char b;
Wire.beginTransmission(devAddr);
//**** look ***
//Wire.write(regAddr); // <=This line must be cut ====
//and this following two lines must be added!!<=========here change=============
Wire.write((int)(regAddr >> 8)); // MSB area to 65535 (64K)
Wire.write((int)(regAddr & 0xFF)); // LSB area to 65535 (64K)
//**
Wire.endTransmission();
Wire.requestFrom(devAddr, 1);
if (Wire.available() > 0)
{
ardublockIsI2cReadOk = true;
b = Wire.read();
data = b;
}
else
{
ardublockIsI2cReadOk = false;
}
return data;
}
Hello can anybody help me, I have solved the problem with the 24 LC512. Can you create a new block for large i2c EEPROMs like this example ? many greetings
// ***** Example***
// This sketch read a eeprom (24c512) from address 0 to address 65535 decimal. // This sketch is an output of ardublock, supplemented with two lines. // Each memorycell being read individually, no page-mode! // Output on the serial monitor. // The devAddr is 80dec or 0x50Hex.
include
unsigned long _ABVAR_1_Counter = 0 ; int _ABVAR_2_Value = 0 ; boolean __ardublockIsI2cReadOk;
int __ardublockI2cReadData(int devAddr, unsigned long regAddr) { int data = 0; char b; Wire.beginTransmission(devAddr);
//**** look *** //Wire.write(regAddr); // <=This line must be cut ====
//and this following two lines must be added!!<=========here change============= Wire.write((int)(regAddr >> 8)); // MSB area to 65535 (64K) Wire.write((int)(regAddr & 0xFF)); // LSB area to 65535 (64K) //**
Wire.endTransmission(); Wire.requestFrom(devAddr, 1); if (Wire.available() > 0) { ardublockIsI2cReadOk = true; b = Wire.read(); data = b; } else { ardublockIsI2cReadOk = false; } return data; }
void setup() { Wire.begin(); __ardublockIsI2cReadOk = false; Serial.begin(9600); }
void loop() { for (_ABVAR_1_Counter= 0; _ABVAR_1_Counter<= (65535); _ABVAR_1_Counter++ ) { delay( 10 ); _ABVAR_2_Value = __ardublockI2cReadData( 80 , _ABVAR_1_Counter ) ;
} }