I2C Interface Usage Requirements and Guidelines

The I2C interface does not support asynchronous behavior. Therefore, functions such as fprintf, fscanf, and query do not work. Use fread and fwrite to communicate using this interface.

You need to have either a Total Phase Aardvark host adaptor or a NI-845x adaptor board installed to use the i2c interface. The following sections describe requirements for each option.

Aardvark-specific Requirements

To use the I2C interface with the Aardvark adaptor, you must download the Hardware Support Package to obtain the latest driver, if you do not already have the driver installed. If you already have the latest driver installed, you do not need to download this Support Package.

If you do not have the Aardvark driver installed, see Install the Aardvark Support Package to install it via the Support Package Installer.

You must install the Aardvark Software API and Share Library appropriate for your operating system.

The aardvark.dll file that comes with the Total Phase Aardvark adaptor board must be available in one of the following locations for use on Windows® platforms.

  • The location where MATLAB was started from (Bin folder).

  • The MATLAB current folder (PWD).

  • The Windows folder C:\winnt or C:\windows.

  • The folders listed in the PATH environment variable.

The aardvark.so file that comes with the Total Phase Aardvark adaptor board must be in your MATLAB path for use on Linux platforms.

If you repower your Aardvark board, set the GPIO pins to output to get communication with a device to work. By default they are configured as input.

NI-845x-specific Requirements

To use the I2C interface with the NI-845x adaptor, you must download the Hardware Support Package to obtain the latest driver, if you do not already have the driver installed. If you already have the latest driver installed, you do not need to download this Support Package.

If you do not have the NI-845x driver installed, see Install the NI-845x I2C/SPI Interface Support Package to install it via the Support Package Installer.

Devices may differ in their use of pullups. The NI-8452 has internal pullup resistors to tie both bus lines to VDD and can be programmatically set. The NI-8451 does not have internal pullup resistors that can be programmatically set, and so require external pullups. Consult your device documentation to ensure that the correct pullups have been used.

Was this topic helpful?