LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to interface i2c accelerometer with LabVIEW and myRIO

This is a general question about the i2c VI and how I can use it to read the xyz linear acceleration data from this accelerometer: https://www.sparkfun.com/datasheets/Sensors/Magneto/LSM303%20Datasheet.pdf 

I understand the slave address, which for my case should be 0011000 (or 18 in hexadecimal) I believe, but I can't figure out what the Byte Count or Bytes Read pieces mean. I am guessing that the Byte Count might be 6 for my case, if I want to read both components of the linear acceleration on each axis, but I can't seem to get any confirmation on that from anyone. Any general help would be useful!

 

If it helps, my specific purpose is to read the accelerometer data using a myRIO and use that information to limit the speed of a motor. I know how to hook up the device to the myRIO.

0 Kudos
Message 1 of 5
(3,570 Views)

Hi m.stoffie,

 

 

Can you tell us what you have tried, and what the results of those attempts?  Are you getting any errors indicating that you are using the wrong number of bytes?  Are you getting data, and aren't sure what it indicates?

 

G-IV

0 Kudos
Message 2 of 5
(3,518 Views)

I haven't created an executable file just yet, as I don't understand what the i2c VI wants from me. I was hoping to see if anyone had used this VI for a similar purpose so I could learn from their experience. A lot of my confusion rests within the data sheet and trying to decipher exactly how to call the acceleration values from the device. Would I need to access particular registers by somehow calling them with the VI (possibly a Read/Write)? I'm unfamiliar with i2c protocal but I want to learn about how to use it!

0 Kudos
Message 3 of 5
(3,490 Views)

Here's the data sheet, since the link I provided seems to be broken.

0 Kudos
Message 4 of 5
(3,488 Views)

Hi m.stoffie,

 

I don't have one of those accelerometers in front of me.  And I can't tell you what you are doing wrong if you haven't tried anything.

 

I'm not sure why you need to create an executable for this process.  If you are using a myRIO, you should be able to develop and test the code on the myRIO.

 

G-IV

0 Kudos
Message 5 of 5
(3,459 Views)