I2CStartoccurred

Syntax:

    I2CStartoccurred

Command Availability:

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

Explanation:

If the I2C routine is operating in Slave mode, this function checks whether a start condition has occurred since the last time the function was called. It is only used in slave mode.

Example:

    'Slave-mode polling loop that waits for the master to begin a transmission
    Do
        If I2CStartoccurred Then          ' <<< the I2CStartoccurred instruction
            I2CReceive DataByte
        End If
    Loop

Key line: If I2CStartoccurred Then — checks whether the master has issued a start condition since this function was last called, so the slave only attempts to receive data once a transmission has actually begun.

See Also:

  • I2C Overview — category overview
  • I2CReceive — receiving the data once a start condition has been detected
  • I2CStart — the master-side command that generates the start condition this function detects

Supported in <I2C.H>