I²C Current Address Read

Just tell me what you have where you are right now…

I2C current address reads are used to read one byte from the current address. The current address will be one beyond the address that was last acted upon.


EEPROM Current Address Read Procedure

  1. Send start condition - wait for it to complete
  2. Send control byte
  3. Check for bus idle
  4. Read in one byte
  5. Send NACK, wait until ACK sequence complete
  6. Send stop condition - wait for it to complete

Example Code (PIC18)

Specific I2C function names and parameters may differ depending on your target device, compiler and/or peripheral library.

while (SSPCON2bits.SEN);
// Initiate START condition
// Wait until START condition is over
WriteI2C(0xA1); // Write 1 byte - R/W bit should be 1 for read
IdleI2C(); // Ensure module is idle
getsI2C(&dataOut, 1); // Read in one byte
while (SSPCON2bits.ACKEN);
// Send NACK condition
// Wait until ACK sequence is over
while (SSPCON2bits.PEN);
// Send STOP condition
// Wait until STOP condition is over
© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.