Chapter 13

I2C Communication

Abstract

This chapter describes the PIC32’s inter-integrated circuit (I2C) communication peripherals. The PIC32 can be a master or a slave and communicate with one or more devices over a two-wire I2C bus. This chapter explains the I2C protocol, how the PIC32 special function registers (SFRs) are used to transmit and receive data, and provides sample code for the PIC32 to act as an I2C master, an I2C slave, and to communicate with an accelerometer and an OLED screen.

Keywords

Inter-integrated circuit (I2C)

OLED screen

I2C bus

Two-wire bus

Each of the PIC32’s four inter-integrated circuit (I2C, pronounced eye-squared-see) peripherals allows it to communicate with multiple devices using only two pins. Many devices ...

Get Embedded Computing and Mechatronics with the PIC32 Microcontroller now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.