I2CStart

Syntax:

    I2CStart

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 condition. If routines are in Slave mode, it will pause the program until a start condition is sent by the master. It should be placed at the start of every I2C transmission.

If interrupt handling is enabled, this command will disable it.

Example:

    'Writes a single byte to an I2C EEPROM at device address 0xA0, memory address 0x00
    I2CStart          ' <<< the I2CStart instruction
    I2CSend 0xA0
    I2CSend 0x00
    I2CSend 0x55
    I2CStop

Key line: I2CStart — sends the start condition that every I2C transmission must begin with, and disables interrupt handling for the duration of the transaction if interrupts were enabled.

See Also:

  • I2C Overview — category overview
  • I2CStop — the matching command that ends the transmission
  • I2CSend — sending bytes between I2CStart and I2CStop
  • I2CReceive — receiving bytes between I2CStart and I2CStop
  • I2CRestart — combining a stop and a new start in one command

Supported in <I2C.H>