Tutorials

Learn More

I2C supports write and read transactions. Many devices also use internal register addresses, so a complete communication often includes both a device address and a register address.

The device address and register address are not the same field. The device address is used by the I2C bus to select a target device. The register address is a data byte sent after the target device is selected, and it points to an internal location inside that device.

Device address vs register address

Register-based I2C transfers commonly contain two address-like values, but they are not the same.

The device address is the 7-bit I2C bus address used to select one target device. For example, device address = 0x68.

The device address byte is the device address plus the read/write bit. For example, device address 0x68 with write direction is sent on SDA as 0xD0.

The register address is an internal address inside the selected device. For example, register address = 0x01.

In a register write example, the controller first sends device address = 0x68 with write direction. After the target ACKs, the controller sends register address = 0x01, then data = 0x80.

Write Operation

In a write operation, the controller sends data to the target.

In a basic write, the controller sends START, the device address with the write bit, one or more data bytes, and STOP. The target acknowledges the address and each received data byte.

Example:

The controller writes data = 0x25 to a device address = 0x48. Check the I2C Transaction Example Diagram.

i2c-write-transaction-clock

Register write operation

Many I2C devices contain internal registers. To write to a register, the controller usually sends the register address first, then the data.

The I2C device address and the internal register address are different fields. The device address selects which device responds on the bus; the register address selects a location inside that device.

Example:

The controller writes data = 0x80 to a register address = 0x01 inside a device address = 0x68. Check the I2C Transaction Example Diagram.

Read Operation

In a read operation, the controller selects a target device and the target sends data back to the controller. The controller still generates the SCL clock, but the target drives SDA during the data byte.

A basic read does not send an internal register address in the same transaction. It reads from the target device’s current address pointer or from a device-defined data output. For register-based reads, use the register read sequence shown in the next section.

Example:

The controller reads data from a device address = 0x48, and the target returns data = 0x3A. Check the I2C Transaction Example Diagram.

In this example, the controller sends device address = 0x48 with read direction. On SDA, this is sent as 0x48 + R = 0x91. After the target ACKs, the target sends data = 0x3A.

For multi-byte reads, the controller ACKs each byte except the final byte.

The controller sends NACK after the final byte, then sends STOP. The final NACK tells the target that the controller does not want more data.

i2c-read-transaction-clock

Register read operation

A register read usually requires two phases:

  1. Write the register address.
  2. Read the register data.

The controller normally uses a repeated START between these phases.

Example:

The controller reads data from a register address = 0x0F inside a device address = 0x1D. Check the I2C Transaction Example Diagram.

The controller first sends 0x1D + W to select the device for a register-address write, then sends register address 0x0F. It then uses repeated START, sends 0x1D + R, and reads the register data byte.

This style is common for sensors, RTCs, EEPROMs, and configuration-based devices.

Current Read Address

Some target devices maintain an internal address pointer. A current address read reads from the current pointer location without first writing a register address.

The pointer is usually updated by a previous register write, register read, or internal device operation. For example, if the previous transaction selected register 0x0F, a current address read may return data from that same register or from the next register, depending on the device.

A current address read is shorter than a register read because it starts directly with device address + R. This behavior is device-specific and should be checked in the datasheet.

Sequential read

Some memory-like devices automatically increment the internal register or memory address after each byte. This allows sequential reading.

In a sequential read, the controller reads multiple bytes in one transaction. The target sends one byte, the controller sends ACK to request the next byte, and the target moves to the next internal address automatically.

This is useful for reading a block of sensor registers, EEPROM memory locations, or FIFO data. The controller sends NACK only on the final byte, then sends STOP.