I²C

Example Programs

The following example I²C programs are available for you to download and test. Each of the example programs defines the following I²C routines. You will need these routines to create drivers for the I²C devices you use.

void i2c_start (void);         // I²C Start Transfer

void i2c_stop (void);          // I²C Stop Transfer

void i2c_write (
  unsigned char input_data);   // Writes data over I²C

unsigned char i2c_read (void); // Reads data from I²C
Bit-Banging
Analog Devices I²C Examples
  • ADU812_I2C.ZIP
    This example program includes C source code for the I²C controller built-in to the Analog Devices ADuC812. It was developed using the Analog Devices Evaluation Board for the ADuC812.
Cypress (AnchorChips) I²C Examples
  • Cypress has very good I²C example code that is part of their USB Frameworks. We recommend that you look at this example code to learn how to use I²C on this part.
Philips I²C Examples
  • LPC_I2C.ZIP
    This example program includes C source code for the I²C hardware built-in to the Philips LPC764. It was developed using the Philips PDS51 Emulator.
  • P87C591_I2C.ZIP
    This example program includes C source code for the I²C hardware built-in to the Philips 87C591. It was developed using the Phytec phyCORE 591 Rapid Development Kit.
Silicon Labs (Cygnal Integrated Products) I²C Examples