i2c. Object

The i2c. object icon.

The i2c. object implements up to eight software I²C channels on the general-purpose I/O lines of your EM2000, EM2001, TPP2(G2), or TPP3(G2). When using the i2c. object, your device acts as the I²C "controller" for the channels, which all have a fixed speed of 100kbit/s and a clock stretching timeout period of 20ms.

Channel selection is accomplished through the i2c.channel property. All other properties and methods of the i2c. object apply to the currently selected channel.

The i2c.enabled property defines whether a channel is disabled or enabled. Configuration of the channel via the i2c.sclmap and i2c.sdamap properties can only be performed when i2c.enabled = 0 — NO.

Operations — sending START and STOP signals (i2c.start and i2c.stop, respectively) and data reads and writes (i2c.read and i2c.write, respectively) — are only possible when i2c.enabled = 1 — YES.