From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

I2C Bus Communication Example Using LabVIEW FPGA

Code and Documents

Attachment

Description

The I2C bus protocol is a widely used communication protocol, developed by Phillips Electronics in 1982 to allow communication between integrated circuits (ICs) from different manufacturers. The I2C bus uses two bidirectional signals, one as the serial clock (SCL) line and one as the serial data (SDA) line. A simple master/slave relationship is present on the bus continuously, and any device on the line can act as the master or slave.

The I2C bus is a multi-master bus with the ability to have multiple slave devices that can all be independently controlled. It uses two bidirectional signals, one as the serial clock (SCL) line and one as the serial data (SDA) line.

Signal Connections:
Connector0 DIO0 to I2C Data
Connector0 DIO1 to I2C Clock

The examples can easily be edited and recompiled for any of the RIO/CompactRIO targets.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.