Skip to content
gicking edited this page Feb 9, 2018 · 3 revisions

back to Command Reference

Library of functions for Inter-Integrated-Circuit (I2C, IIC or Wire) communication (currently only master mode).

The I2C bus is a multi-slave serial communication bus invented by Philips Semiconductor (now NXP). It is generally used for on-board, lower-speed peripherals. Big advantage over e.g. SPI is that it only requires two pins (SCL and SDA) for up to (theoretically) 112 slaves nodes. However, I found I2C to be less stable than SPI. Actually, this is also highlighted in the german I2C Wikipedia (as I found out afterwards).

I2C is appropriate for peripherals where simplicity and low manufacturing cost are more important than speed. Some applications are:

  • sensors
  • GPIO extensions
  • EEPROMs and NVRAMs
  • low-speed DACs and ADCs
  • real-time clocks and NVRAM chips that keep user settings
  • controlling intelligent speakers or displays

Another notable example is Lego mindstorms, which uses I2C for its "smart sensors". For brief description how to connect the STM8 see here.

The below commands are not auto-loaded in Arduino-like projects, i.e. which include main_general.h. See the respective description on how to include them into your projects.

Commands:

Clone this wiki locally