ds1307_how_to_access_ram

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ds1307_how_to_access_ram [2011/09/12 21:40] tomgeeds1307_how_to_access_ram [2011/09/12 21:44] (current) tomgee
Line 10: Line 10:
      Wire.send(8);       Wire.send(8);
      Wire.endTransmission();      Wire.endTransmission();
 +
 +This will set the I2C address to 0x68, the DS1307 Address.\\
 +The second line sets the register index to 8, the start of RAM.\\
 +The third line, Wire.endTransmission(); , transmits the sequence.\\
 +
 +Subsequent reads from the chip will start at 8. For example, to read 4 bytes from the chip:\\
 +     Wire.requestFrom(DS1307_ADDRESS, 4);
 +
 +The above line will put the 4 bytes into the receive buffer. To fetch the bytes:
 +
 +     while(Wire.available())    // slave may send less than requested
 +     
 +      byte c = Wire.receive(); // receive a byte as character
 +      Serial.print(c, HEX);         // print the character
 +      Serial.print(" ");
 +     }
 +
 +
ds1307_how_to_access_ram.1315878020.txt.gz · Last modified: 2011/09/12 21:40 by tomgee