I2C Communication Example for Digital Pattern Instruments

Updated Jul 1, 2019

Reported In


  • PXIe-6571
  • PXIe-6570


  • NI-Digital Pattern Driver and Digital Pattern Editor

Issue Details

Where can I find examples to send I2C commands with my PXIe-6570?


While the PXIe-6570 can certainly be used for I2C communication but there are currently no shipping examples that demonstrate this capability.

The most common use case would for this is to drive an X value rather than a 1 when sourcing waveforms on open-drain busses like I2C. When combined with Active Load enabled, replacing 1’s in the source waveform with X will cause the bus to behave as if it’s being pulled up by an external pull-up resistor. 

From the version 18.0 of the NI-Digital Pattern driver, there is a new functionality added:

"Sourcing Tristate and Compare Pin States

The pattern compiler now supports a digital source and capture opcode called source_d_replace. This opcode enables you to use more pin states with source memory by replacing pin states 0 and 1 with pin states 0, 1, H, L, or X. You can add source_d_replace to any vector to change the interpretation of the source pin states from that vector forward. This feature provides more source waveform flexibility with open-drain busses like I2C."

To get started implementing your I2C application you can modify the SPI Example and use it as a reference.


Additional Information

The example project Digital Pattern Instrument: Source Synchronous Acquisition on our Code Exchange has been found to be helpful in developing I2C slaves and masters. 


Not Helpful