LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB 8451 - SMbus with labview: help please

Dear all,


I just purchased an USB 8451 and I need to interact with a smart battery using a labview interface. I really need a departure point to build up a VI read/write and finally interact with the battery, and the tutorial on NI website  ( http://www.ni.com/white-paper/5767/en/) seems not too exhaustive to me. I set the I2c configuration property node as specified, but I have some doubts on the adress to put, is it really 1010000 for the smart battery (it is my only slave)... Once this is solved, how to "ask questions" to the battery?

 

Could anyone who had the same problem than me post a complete VI I can use as starting point?

 

It seems like I must gather much more information about this topic, so, please, any suggestion on how to interact with the battery is welcome....

 

 

0 Kudos
Message 1 of 6
(3,398 Views)

Yep, the problem is definitively the adress of the slave (smart battery), which I set to 1010000 as specified in the NI tutorial, but that is not correct, because this is the error message I get when trying to read two bytes:

 

Possible reason(s):

NI-845x: The slave did not acknowledge an address+direction byte transmitted by the I2C master. If you are using ACK polling, consider increasing the timeout. Other reasons include the incorrect address set in the I2C configuration or the incorrect use of the 7-bit address. When entering an address to access a 7-bit device, do not include the direction bit. The NI-845x Basic I2C API internally sets the direction bit to the correct value, depending on the function (write or read). If your datasheet specifies the 7-bit device address as a byte, discard the direction bit (bit 0) and right-shift the byte value by one to create the 7-bit address.

 

I also attach my VI 

0 Kudos
Message 2 of 6
(3,396 Views)

I loaded your VI (but don't have the 8251 driver loaded under LV2013).  That address you reference surely must be quoted in some documentation as a binary value.  But your integer wired into the "address" is a large decimal number.

 

My guess is that your desired address value is eighty, which (if you pop up on your constant, or a control or indicator, and set "show radix" [Edit: Visible Items->Radix]) is:

 

d80

x50

b1010000

(OK,  just to be complete: o120)

 

These are all the same value, just displayed in different bases.

 

Hope that helps...

Dave

 

 

 

David Boyd
Sr. Test Engineer
Abbott Labs
(lapsed) Certified LabVIEW Developer
0 Kudos
Message 3 of 6
(3,370 Views)

Thanks David for your help... 

 

Yes, you are right, I have to set the binary value....

 

I now edited the binary type by changing the radix of the constant (see VI attached) but I still get the same problem.... I start to think that maybe the module does not work properly with SMbus but only I2C (some previous post of other users having exactly the same error message when trying to interact through SMbus).

 

PS I put 5K pull up resistors from SDA and SCLK and set the clock rate to 60 KHz

0 Kudos
Message 4 of 6
(3,362 Views)

I solved the problem and I am able to communicate with the battery...as I thought, the problem was the adress of the slave, which is 0x16 (including the R/W bit) or 0xB (not including the R/W bit). Since the R/W is added automatically by the labview by calling the read or write I2C function, the correct adress to put is 0xB. It works proerly now and I attach the VI for those who would need in the future (I see in the forum it is actually a very demanded topic).

 

Best,

 

Fabrizio

0 Kudos
Message 5 of 6
(3,299 Views)

The subVI could not be found when loading this VI. The missing subVI is part of the NI-845x Driver. The subVI cannot execute on this target, or the driver is not installed or supported on this OS. If the driver is supported on this OS, move the subVI to the correct target, or exit LabVIEW and install the NI-845x Driver.

0 Kudos
Message 6 of 6
(2,423 Views)