2.7.3.1 Single Write

The first seven bits of the first byte make up the target address. The eighth bit is the LSB (least significant bit). It determines the direction of the message (R/W). A ‘zero’ in the least significant position of the first byte means that the host will write information to a selected target. A ‘one’ in this position means that the host will read information from the target. When an address is sent, each device in a system compares the first seven bits after the START condition with its address. If they match, the device considers itself addressed by the host as a target-receiver or target-transmitter, depending on the R/W bit.

Command byte is a data byte which selects a register on the device (address of the register that needs to be written).

The data to port is the 8-bit data that needs to be written to the selected register. This is followed by the acknowledge from the target and then the STOP condition.

The write command is as follows, and it is illustrated in the timing diagram below.

  1. Send START sequence
  2. Send 7-bit target address
  3. Send the R/W bit – 0 to indicate a write operation
  4. Wait for Acknowledge from the target
  5. Send the command byte - Address that needs to be written
  6. Wait for acknowledge from the target
  7. Receive the 8-bit data from the host and write it to the target register indicated in step 5 starting from MSB
  8. Acknowledge from the target
  9. Send STOP sequence
Figure 2-12. I2C Single Write
Note: Writing to a read-only register, a non-existing or not user-accessible register will still generate an ACK by the MCP16503 after the command byte, but it will have no effect.