LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

ADXL 345 Sparkfun-- I2c--LabVIEW--Arduino

Rewired to set to 0x1D and thgen updated the VI to post the three bit sequence. No success. I'm working with Arduino 1.0.4 and an Uno r3 with LabView 2012 and an ADXL345EB. Nothing seems out of place but I can;t get any data to transfer between the Uno and LV, when I insert probes everything comes up as zeros...

Modified VI attached

0 Kudos
Message 51 of 87
(1,698 Views)

I'm quite sure that I figured out what is going wrong.  It is actually quite trivial but LabVIEW won't let me fix it.  I'll let you know when I figure it out.

Message 52 of 87
(1,698 Views)

Ok, I got it fixed.  Go and download the library again (v1.1.2) from the original document.

Message 53 of 87
(1,698 Views)

Hi all! I'm reading this forum to study i2c communication. Could someone explain me why the I2c Write Express VI takes an input made by register address and data value combined in "build array" function? Thanks,

Regards.

0 Kudos
Message 54 of 87
(1,698 Views)

Building the array in the I2C subVI is how LIFA sends the data to the Arduino.  To interact with the I2C sensor, you need to specify the device address (to know which device on the bus to talk to), the piece of information that you want to access on the sensor (register address), and sometimes some sort of information to give to the sensor.

0 Kudos
Message 55 of 87
(1,698 Views)

Thank you so much Nathan. So the input "I2C Data Bytes" is an array that I realize appending the information to register address? Can I found any documentation about the I2C Express VIs for Arduino? Thanks again.

0 Kudos
Message 56 of 87
(1,698 Views)

Just to clarify the LabVIEW nomenclature, the VIs that you use with LIFA are not "express" VIs (Click here for a definition of an Express VI).  They are simply called subVIs.

Anyways,  the first place to look for information about any VI or subVI is the Context Help window.  If you are unable to fully understand it from that, go to the Detailed Help page if available (afaik, the LIFA subVIs don't have a detailed help page).  If you still don't understand it, the only thing that you can do is start looking at the code.  However, with LIFA, you will probably also need to learn how the firmware handles the code as well in order to understand the complete functionality because the firmware is where the I2C communication is actually occuring.

So, I would describe the inputs to the I2C write subVI as follows:

  • First byte:  Device Address
  • Second byte:  Register Address
  • Third and subsuquent bytes (optional):  Data

where a "byte" is simply an array element.

0 Kudos
Message 57 of 87
(1,698 Views)

Thank you Nathan for this great explanation. If I can, I have the last question: the image in the previous page represents the using of "Index array" and "Join numbers" functions. Why the first output of Index array is the second input of Join numbers (it's the same question for the second output)? Is it a left-justifying implementation?

0 Kudos
Message 58 of 87
(1,698 Views)

If you send the least significant byte (LSB) first and the most significant byte (MSB) second, then you need to use them in the appropriate order.  So, if you are writing the firmware function yourself, you can choose to send them back in any order you like and then use them accordingly in LabVIEW.  Some sensors may send the LSB first and others the MSB and it is often convenient to just send them back to LabVIEW in the same order as the sensor sends them to Arduino.  But, when you write your own LIFA function, you can choose to do it how ever you like.

When using I2C directly from LabVIEW, you don't really have a choice and have to accept the data in the order that the sensor returns it.

0 Kudos
Message 59 of 87
(1,698 Views)

Well Nathan, your help was very useful. If I want to read data from LSM303 in registers that give me Low and High value (for x,y and z axes) with "I2C Read", how can I communicate to this subVI the Slave Address, the address of six registers (low and high for x, y, z) and the number of bytes to read? is there a way to create a list of register that I use as input? Thanks, best regards.

0 Kudos
Message 60 of 87
(1,698 Views)