Arduino with LSM9DS0

i’m having problem understanding the code that i get from the website, the project is basically print out the output getting from LSM9DS0 sensor. This is the code with the datasheet os LSM9DS0 that i attached. The problem is i don’t understand why need get raw data from X ,Y and Z axis. Moreover, “Serial.print(0.00875*(X_AXIs+110),DEC)” why need add 110 and then multiplies with 0.00875??. I found out that the 0.00875 is the sensitivity (pg13 from the datasheet) but how about adding 110??. The part with Wire.beginTransmission((Address_XM I Write)>>1) i oso dont understand. Hope u guys can help me and its my final year project. Thank you.

arduino_code.ino (8.46 KB)

LSM9DS0.pdf (1.62 MB)

Hi Calvin

I think I can answer the first question.

byte X_L = ReadRegister_G(OUT_X_L_G);
byte X_H = ReadRegister_G(OUT_X_H_G);
...
int X_AXIs = X_H <<8 | X_L;

The X value is a 16 bit signed integer. But it is read from two different 8 bit registers. The first two statements read the low byte and high byte into separate variables. The last statement then shifts the higher 8 bits left by 8 bit positions and bitwise ORs ("|" operator) it with the bottom 8 bits, to give the 16 bit value .

This is the same as multiplying the high 8 byte by 256 and adding the low byte. But the shift and OR should be quicker to execute.

More info here:

http://playground.arduino.cc/Code/BitMath

Regards

Ray

Thank you, Hackscribble.