The Book of I2C cover

The Book of I²C

A Guide for Adventurers
by Randall Hyde
August 2022, 440 pp.
ISBN-13: 
9781718502468

Download Chapter 8: ARDUINO I²C PROGRAMMING

If you work with embedded systems, you’re bound to encounter the ubiquitous Inter-Integrated Circuit bus (IIC, I2C, or I²C)—a serial protocol for connecting integrated circuits in a computer system. In The Book of I²C, the first comprehensive guide to this bus, bestselling author Randall Hyde draws on 40 years of industry experience to get you started designing and programming I²C systems.

For hardware hackers, electronics hobbyists, and software engineers of every skill level, the extensive coverage in this book will make it a go-to reference—whether you need an overview of I²C signal protocols, an introduction to variants of the I²C, like the SMBus and VESA E-DCC, or programming examples for common I²C peripheral ICs. You’ll also learn the I²C implementations of the Arduino, Teensy, and Raspberry Pi systems among others, as well as how to:

  • Analyze and debug I²C bus transactions
  • Program devices on the I²C
  • Implement an I²C with bare-metal programming 
  • Work with I²C bus expanders

The Book of I²C includes over 100 figures and many annotated source code listings, along with online chapters that will be updated to include new controllers and peripherals.

*NOTE: Readers should have basic C/C++ and hardware interfacing knowledge, including the ability to read schematics and wire up a COTS SBC, plus some familiarity with Arduino.

Author Bio 

Randall Hyde is the author of The Art of Assembly Language and Write Great Code, Volumes 1, 2, and 3 (all from No Starch Press), as well as Using 6502 Assembly Language and P-Source (Datamost). He is also the coauthor of Microsoft Macro Assembler 6.0 Bible (The Waite Group). Over the past 40 years, Hyde has worked as an embedded software/hardware engineer developing instrumentation for nuclear reactors, traffic control systems, and other consumer electronics devices. He has also taught computer science at California State Polytechnic University, Pomona, and at the University of California, Riverside. His website is http://www.randallhyde.com/.

Table of contents 
Introduction
Chapter 1: I²C Low-Level Hardware
Chapter 2:
I²C Protocol
Chapter 3: A Software Implementation of the
I²C Bus
Chapter 4: Analyzing and Debugging
I²C Transmissions
Chapter 5:
I²C Variants
Chapter 6: 
I²C on Common Single-Board Computers
Chapter 7:
I²C on Vendor Buses
Chapter 8: Arduino
I²C Programming
Chapter 9: Raspberry Pi (and Linux)
I²C Programming
Chapter 10:
I²C Programming in Real-Time Operating Systems
Chapter 11: Bare-Metal
I²C Controller Programming
Chapter 12: The TCA9548A
I²C Bus Expander
Chapter 13: The MCP23017 and MCP23008 GPIO Expanders
Chapter 14: The ADS1015/ADS1115 Analog-to-Digital Converters
Chapter 15: The MCP4725 Digital-to-Analog Converter
Chapter 16: Bare-Metal Peripheral Programming
Appendix A: Glossary
Appendix B: The Adafruit
I²C Address Compilation