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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LM92 I2C temperature sensor with NI-8451

Solved!
Go to solution

Hello !

 

I try to communicate with a LM92 temperature sensor via the NI USB-8451 by I²C protocol. I have an issue with the addressing because the 7 bits sensor address is 1001011 (A1 and A0 set to 1) but the LM92 is working in little endian (LSB first) and Labview adds the R/W bit at the end of the address so the complete frame sent to the LM92 is 1001011R/W.

 

I'm trying to find a solution to invert the complete frame before seending it in order to communicate with the LM92.

Labview returns the error -301742 because the address is not the wright one and i can't find how to send the adress in little endian.

 

I just need to read the temperature register of the sensor so i don't need to write anything in it.

 

Does anyone have an answer ?

Download All
0 Kudos
Message 1 of 10
(4,501 Views)

@Sanguigui wrote:

Hello !

 

I try to communicate with a LM92 temperature sensor via the NI USB-8451 by I²C protocol. I have an issue with the addressing because the 7 bits sensor address is 1001011 (A1 and A0 set to 1) but the LM92 is working in little endian (LSB first) and Labview adds the R/W bit at the end of the address so the complete frame sent to the LM92 is 1001011R/W.

 

I'm trying to find a solution to invert the complete frame before seending it in order to communicate with the LM92.

Labview returns the error -301742 because the address is not the wright one and i can't find how to send the adress in little endian.

 

I just need to read the temperature register of the sensor so i don't need to write anything in it.

 

Does anyone have an answer ?


I do not have the USB-8451 to check this myself, but based off of this document: http://www.ni.com/white-paper/5767/en/ I would guess you should be looking into these two VIs:

 

Advanced LabVIEW API for Device Addressing

Use the Script Address + Write or + Read Functions after a Script Issue Start function to program the device address.

 

Note:  This, however, is just a shot in the dark.  It seems like deep down they are calling a library, so it may be out of your control unless you have access to the library being called as well. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If someone helped you out, please select their post as the solution and/or give them Kudos!
0 Kudos
Message 2 of 10
(4,490 Views)

Thank you MrHappyAsthma i'll give it a try !

0 Kudos
Message 3 of 10
(4,481 Views)

Sorry  MrHappyAsthma but the advanced adressing didn't worked... I think i may have to modify one of the adressing vi in order to transfer my frame in little endian...

0 Kudos
Message 4 of 10
(4,440 Views)

@Sanguigui wrote:

Sorry  @MrHappyAsthma but the advanced adressing didn't worked... I think i may have to modify one of the adressing vi in order to transfer my frame in little endian...


Ah Im sorry to hear that.  I was hoping those advanced functions would give you more control over Bit Order.

 

Based off of the VIs in the sample code provided in the original post, it seems like the address gets the extra r/w bit added inside NI-854X I2C Read VI.  Specifically in the Call Library Function Node:

 

library node.jpg

 

If you can access that, then you should be able to flip the bits and add the read bit to the front.  Then you could do similarly for the write.  However Idk how deep into the library you are able to access/modify as I do not have it installed.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If someone helped you out, please select their post as the solution and/or give them Kudos!
Message 5 of 10
(4,434 Views)
Solution
Accepted by topic author Sanguigui

To solve the problem :

 

The adressing problem doesn't come from the adress sent in Big Endian, my LM92 was on a board and a driver forbade the LM92 sensor to communicate with my USB-8451 (i don't know why yet).

So I just desoldered my LM92 and solded directly +5V SDA SCL and GND wires on it and it works with the Labview examples that you can find in HELP -> Find examples

 

Thank for trying to help me MrHappyAsthma !

Message 6 of 10
(4,359 Views)

Is there any NI modules which contains analog measurements and digital measurements and frequency and also main I2C communication in one module???

Please give a suggesion if any third party modules also including above parameters.

0 Kudos
Message 7 of 10
(4,286 Views)

Hi vam,

 

please stop creating double/multiple posts for the very same question!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 10
(4,278 Views)

@Sanguigui, I was having a similar issue recently but not with the LM92. Areyou suggesting that by connecting the IC directly with the NI interface, wewill have no issues in addressing? I wanted to know if the LM92 reconfigureditself to work with big endian system or did LabView convert the address tolittle endian. It’s a bit confusing as you found a solution where you didn’t tore-program or reconfigure something that seemed to be a configuration orprogramming issue.

0 Kudos
Message 9 of 10
(4,151 Views)

@kurt81

 

The driver on my PCB worked with 5V command but the NI USB-8451 works with 3.3V max so when desoldering the driver my message in little endian was well understood.

By searching to modify the C program directly i found that users doesn't have the right to modify the codes already implanted.

 

And yes i solved the problem by directly connecting my sensor to the NI 8451 because it works by default in I2C, the driver was only here to avoid communication loss by repeating the signal.

In the Labview examples for I2C communication you will find a function to convert the address from big to little endian so my LM92 didn't reconfigure itself !

0 Kudos
Message 10 of 10
(4,147 Views)