According to the datasheet of L3G4200D, x_lsb and x_msb (28h and 29h), y_lsb ,y_msb (2Ah and 2Bh), z_lsb , z_msb (2Ch and 2Dh) as shown in the picture 3. But according to code that in the picture first, arduino requests biytes from 168 adress of gyro(in the pciture ,mark number is 1). But , 0x28 (hex) stands for b00101000 . what's wrong with it ?
168 is, in hex, 0xA8. That's 0x28 with the MSB set. Why? Well, the datasheet says:
In order to read multiple bytes, it is necessary to assert the most significant bit of the subaddress
field. In other words, SUB(7) must be equal to 1, while SUB(6-0) represents the
address of the first register to be read.
So address 0xA8 is the same as address 0x28 plus the instruction "I want to read multiple bytes".
Output of gyro is outputs degrees/second ,is it correct ?
Kind of. The number is actually a representation of the fraction of FS. See below.
in the picture 1,what I should calculate hightbyte*256+lowbyte ?
That is turning two 8-bit values into a single 16-bit value. It's easier to represent it using bit shifts:
(bighbyte << 8) | lowbyte
That is, the high byte is shifted left 8 bits and the low byte is then ORed over the lower (zero) 8 bits.
What does Fs=250,500,2000 dps mean ? I know that Dps stands for Degree Per Second .But what would change by FS range ,I mean if I pick either 500 or 2000 ?
That is the "Full Scale" value. It defines what the raw numbers from the gyro actually mean. The gyro returns -32768 to +32767. -32768 is -FS, +32767 is +FS. So if the FS is set to 500 degrees per second then:
- -32768 is -500 degrees per second
- +32767 is +500 degrees per second
The simple formula is (using floating point maths):
DPS = Reading / 32768.0 * FS
The format is more commonly known as Q15 where a 16-bit value is split into 3 parts - a sign bit (bit 15), an integer part (there isn't one in this case), and 15 bits (14-0) of fraction. So the number actually represents, in Q15 format, between -1 and +1 in 65536 steps of 1/65536. That number is then multiplied by the full scale value, just like you would a percentage, to get the real DPS value.