.read Method

Function:

Reads one byte from the currently selected I²C channel (selection is made through i2c.channel).

Syntax:

i2c.read(ack_bit as enum i2c_ack_nack)

Returns:

One byte of data from the selected I²C channel.

See Also:

---


Part

Description

ack_bit

This parameter determines which "acknowledge" bit to send to the target I²C peripheral after reading 8 bits of data (enum i2c_ack_nack):

  • 0 — ACK
  • 1 — NACK

What the target does with this acknowledge bit is device-dependent. Please refer to the datasheet of your attached I²C peripheral for specific details.


Details

This method can be invoked only when i2c.enabled = 1 — YES. Calling this method when the channel is disabled will always return 0.


.read Method

Details