12-13-2013 11:20 PM
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.
12-14-2013 03:25 AM
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.
12-14-2013 02:04 PM
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.
12-14-2013 02:11 PM
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.
12-14-2013 02:48 PM
I don't understand the question. What do you need my library to do differently?
12-14-2013 04:58 PM
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.
12-14-2013 05:27 PM
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").
12-14-2013 05:43 PM
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?
12-14-2013 06:16 PM
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.
12-16-2013 03:11 AM
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?