I2CRestart

Syntax:

    I2CRestart

Command Availability:

Available on all microcontrollers except 12 bit instruction Microchip PIC microcontrollers (10F, 12F5xx, 16F5xx chips)

Explanation:

If the I2C routines are operating in Master mode, this command will send a start and restart condition in a single command.

Example:

    'Switch from writing to reading within the same transaction, without a full stop/start
    I2CStart
    I2CSend 0xA0
    I2CSend 0x00
    I2CRestart          ' <<< the I2CRestart instruction
    I2CSend 0xA1
    I2CReceive DataByte
    I2CStop

Key line: I2CRestart — issues a stop and a new start in a single command, letting the transaction switch direction, such as from writing to reading, without releasing the bus in between.

Supported in <I2C.H>

See Also:

  • I2C Overview — category overview
  • I2CReset — related command in the same category
  • I2CReceive — related command in the same category