Example Code

Free I2C Bus using the NI-845x

Code and Documents

Attachment

Description:

This example resets (frees) the I2C bus and halts communication for any I2C Master and Slave by making external connections from the DIO lines on the NI-845x to the SCL and SDA lines of the I2C bus. The idea is that an 845x can "interrupt" the communication between two or more other I2C devices so that it can talk to the previously busy I2C devices.

External wiring:

1. Connect P0.0 to the SCL line.
2. Connect P0.1 to the SDA line.
3. Set your external resistors (no lower than 1 kOhm). Please reference the NI-845x Hardware and Software Manual wiring diagram on page 3-19 (page 49 of the PDF viewer) for further reference.
4. Connect all I2C devices to the bus.

Instructions for Running:

1. Have any I2C master talk continuously to a slave.
2. Open Free I2C Bus.llb » MAIN - Free I2C Bus.vi.
3. Select your NI-845x device.
4. Set the DIO driver type to Open-Drain.
5. Select the I/O Voltage Level.
6. Run the VI.
7. I2C communication should be terminated, so the NI-845x is ready to talk to the I2C devices.

Free I2C Bus.png

Regards,
Daniel REDS
RF Systems Engineer

Help us grow.
If a post solves your question, mark it as The Solution.
If a post helps, give Kudos to it.

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

Contributors