Electronic – I2C dumthe write

i2c

If you want to read from the I2C bus you have to:

  1. Send start condition
  2. Send 7 bit slave address with R/W being a '0' which indicates a write
  3. Send register number where you want to read from
  4. Send start condition again
  5. Send 7 bit slave address with R/W being a '1' which indicates a read
  6. Slave sends data to master and master will send an ACK after each byte
  7. When done, the master sends a stop condition

Why isn't it done like this:

  1. Send start condition
  2. Send 7 bit slave address with R/W being a '1' which indicates a read
  3. Send register number where you want to read from
  4. Slave sends data to master and master will send an ACK after each byte
  5. When done, the master sends a stop condition

Wouldn't this be more efficient?

Best Answer

Michael gave you the formal response, which is how I2C is defined. The practical problem with your approach is that you fix the register address at 8 bytes. What if a slave

  • has only a single register? Sending 8 address bits would be a waste of time, and a waste of circuitry in the slave.
  • has more than 255 registers?

If you address these issues, you end with a protocol that depends on the type of slave. That would complicate matters considerably.