Cannot get Labview to work with I2C | LabJack
 

Cannot get Labview to work with I2C

5 posts / 0 new
Last post
daveedius
daveedius's picture
Cannot get Labview to work with I2C

I'm trying to read registers via I2C. I can get it to work perfectly using the python library but can not get it to work with the Windows UD library. 

When running the VI, I get zero acks even though I am using the exact same settings as python. Can anyone see anything wrong with my VI?

LabJack Support
labjack support's picture
It looks like you are writing

It looks like you are writing a single byte of 0, is that intentional? What does your Python code look like, or alternatively what are you trying to write and read and with what settings? Your setup looks okay on first glance.

daveedius
daveedius's picture
The device is an EMC2101-R

The device is an EMC2101-R fan controller which loads the firmware from an attached EEPROM into its own registers. I'm trying to perform three operations: read register 0x00, write 0xFF to register 0x00 and then read register 0x00 to verify the write operation.

 

I've attached my python code which works perfectly; my attempt to duplicate it verbatim in labivew has been futile. The VI doesn't seem to be actually reading the registers and returns no acks.    

 

LabJack Support
labjack support's picture
The LabJackPython API expects

The LabJackPython API expects a 7-bit address for the i2c Address input parameter. It then automatically shifts the sensor address left one bit to get an 8-bit address for the low level command. The UD library used in LabVIEW does not do this, it expects an 8-bit address, so you must do the shift yourself in software. Please try using 152 for your LJ_chI2C_ADDRESS configuration. Sorry for the confusion.

daveedius
daveedius's picture
You know I had a feeling it

You know I had a feeling it had something to do with the address and must have checked it 20 times. But that fixed everything, thanks for the help!