LabVIEW Interface for Arduino Discussions

cancelar
Mostrando resultados para 
Pesquisar então 
Você quer dizer: 

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

Are you using an ADXL345 or an LSM303XXX (and thus which version of the LSM303)?

Just to clarify, are you asking how you would read multiple registers?  If yes, the answer depends on the actual device because this does not seem to be standardized (based on the sensors that I've used).

I have posted documents for both the ADXL345 and the LSM303DLM.  You can look in each of those libraries to see how it's done for those particular sensors.

0 Kudos
Mensagem 61 de 87
2.411Exibições

I'm using LSM303dlmtr and I've seen your great work about these two sensors. My objective is to realize a VI using subVI only for I2C read and write,"opening" your sensor subVI. I'm asking about the explanation of the method to read all the registers: how can I specify all the inputs (slave address, exact register and bytes to read)?  During the reading have I to use also I2C write subVI? Thanks Nathan.

0 Kudos
Mensagem 62 de 87
2.411Exibições

The LSM303DLMTR is the exact same sensor as the LSM303DLM but in different packaging.  The TR stands for "tape and reel" packaging.  Therefore, you should be able to use the library that I posted.

0 Kudos
Mensagem 63 de 87
2.411Exibições

Ok, it's perfect. Can I to insert the six acceleration registers address in an array and use both I2C write and I2C read for the reading operation instead of constant with scroll button?I would to know the principle of your choice. Thank you so much.

0 Kudos
Mensagem 64 de 87
2.411Exibições

I don't understand the question.  What do you need my library to do differently?

0 Kudos
Mensagem 65 de 87
2.411Exibições

You use a subVI named "LSM303 read" and in this subVI there the right functions to read acceleration and magnetic field. I don't want to use subVIs and "multiple byte read" (if it is possible). I would to know which are the blocks that I've to insert for read all the registers: how the registers address control communicates all the addresses? I need to use both I2C read and write subVIs? I've to change the slave address from I2C write to I2C read with the bit thspecifies the operation?I'm referring to image I'm attaching. Thanks.

Lsm.jpg

0 Kudos
Mensagem 66 de 87
2.411Exibições
  • Typically, "good" LabVIEW programming uses subVIs.  If you don't want to use the subVI, you can simply copy the code from the subVI and place it in your VI and then correctly hook up all the broken wires (when copying from a subVI, don't copy the controls and indicators).  Generally, I do not recommend doing this because it is easy to introduce runtime errors or bugs.
  • Not using the multiple byte reading provided by the sensor will slow down your LabVIEW program so it should be used whenever possible.
  • If you are curious about the "Set Multibyte Read" function, it lets the device know that you want to read multiple sequential registers.  This is one of the things required by this device that is not required by others.
  • You say you want to read all the registers.  What specific registers are you trying to read?
  • To perform an read operation using the I2C protocol, you must first write to the device to tell it what register you want to read.  Then, you need to read the information that it sends back to you.  So, this requires both subVI (write and then read) to perform a read operation.
  • The device/slave address is a unique identifier of the device/sensor and thefore the device address does not change unless you are going to talk to a different device.

If this doesn't answer your questions, then I'm having trouble understand what you are trying to do (in the long run, aka the "Big Picture").

0 Kudos
Mensagem 67 de 87
2.411Exibições

Great explanations Nathan. In the past posts probably my english wasn't so good. The doubt about register address .ctl concerns the behaviour of this one. Opening the its "properties"-->"edit items" menù with right click I see a list of the registers: how the program passes from a register to the following during the reading? Can I use an array containing the addresses? Is the order of this "list" important?

0 Kudos
Mensagem 68 de 87
2.411Exibições

The "Accel Register Addresses.ctl" and the "Mag Register Addresses.ctl" are simply lists that give a meaningful name to a number.  When you use either of these in a VI (as a control, indicator, or constant) they are simply a scalar value (meaning one value, not an array).

So, when I choose OUT_X_L_A and then do a multibyte read, it will send back the OUT_X_L_A value first then it will go to the next register which is OUT_X_H_A and send that back.  It will continue to do this until you stop the communictation.  The sensor handles all of the multibyte reading stuff (and thus has a fixed order as shown in the datasheet).  The OUT_X_L_A that you see on the block diagram is simply telling it where to start.  Therefore, the order of the items in the .ctl file does not matter as long as the name stays with the correct number.  See pages 21 and 22 in the datasheet.

0 Kudos
Mensagem 69 de 87
2.411Exibições

Very exhaustive answers, I've understood. After the "Joint Numbers" function with a subsequent transformation of the date in a 16-bit integer,  are necessary a 4-right shift for a 12-bit left justified reading or a division for the full-scale range?

0 Kudos
Mensagem 70 de 87
2.411Exibições