Buscando por la red encontre un proyecto muy bueno de un logger usando un reloj(ds1307), un termometro(ds1631) y una eeprom, entiendo casi todo pero hay un par de lineas que no entiendo que son.
Link del proyecto
Definicion de direcciones
//// I2C ADDRESSES ////
// DS1307 RTC chip
#define RTCI2C (B1101000)
// DS1631 Temp sensor
#define TEMPI2C (B1001000)
// AT24C1024B EEPROM
#define EEPROMI2C (B1010000)
Leemos la SRAM del reloj DS1307
// Extract the read count from the clock's battery backed
// SRAM to make sure we don't overwrite data on the EEPROM
// after power loss.
Wire.beginTransmission(RTCI2C);
Wire.send(0x08);
Wire.endTransmission();
Wire.requestFrom(RTCI2C, 2);
tempreadcount = Wire.receive() << 8; // MSB
tempreadcount += Wire.receive(); // LSB
lcd.setCursor(0,0);
lcd.print("READ CNT: 0x");
lcd.print(tempreadcount, HEX);
Grabamos la temperatura y actualizamos el contador del reloj
void writetemp() {
digitalWrite(LEDPIN, HIGH);
long wordaddr = ((long)tempreadcount) * 2;
// AT24C1024B adds the 17th addr bit to I2C addr
byte eei2caddr = EEPROMI2C | (wordaddr>>16);
// Write out tempurature to EEPROM
Wire.beginTransmission(eei2caddr);
Wire.send((byte)(wordaddr>>8) & 0xFF);
Wire.send((byte)(wordaddr) & 0xFF);
Wire.send(temp[0]);
Wire.send(temp[1]);
Wire.endTransmission();
// Update read count here and in clock's SRAM
tempreadcount++;
Wire.beginTransmission(RTCI2C);
Wire.send(0x08);
Wire.send((byte)(tempreadcount>>8) & 0xFF);
Wire.send((byte)(tempreadcount) & 0xFF);
Wire.endTransmission();
delay(10);
digitalWrite(LEDPIN, LOW);
}
Pero en este codigo no entiendo varias lineas
Wire.send((byte)(tempreadcount>>8) & 0xFF);
tempreadcount = Wire.receive() << 8; // MSB
byte eei2caddr = EEPROMI2C | (wordaddr>>16);
Saludos