AnsweredAssumed Answered

Reading status register of LSM6DS3

Question asked by JAMES.ASHNO on Jan 31, 2017

hi, 

    I am Reading the Accelerometer and Gyroscope sensor values by checking the XLDA and GDA bits as follows

      

       if((readReg(STATUS_REG)&0x01)==0x01)     // checking XLDA
        {

              Ax = (int16_t) readReg(OUT_X_H_A) <<8 | readReg(OUT_X_L_A);
              Ay = (int16_t) readReg(OUT_Y_H_A) <<8 | readReg(OUT_Y_L_A);
             Az = (int16_t) readReg(OUT_Z_H_A) <<8 | readReg(OUT_Z_L_A);

       }


if((readReg(STATUS_REG)&0x02)==0x02)        // checking GDA
{
Gx = (int16_t) readReg(OUT_X_H_G) <<8 | readReg(OUT_X_L_G); // typecast as
Gy = (int16_t) readReg(OUT_Y_H_G) <<8 | readReg(OUT_Y_L_G); // 16-bit
Gz = (int16_t) readReg(OUT_Z_H_G) <<8 | readReg(OUT_Z_L_G);
}

   

 

But i get stuck by values around -112,-113.......when tilting the z axis from 1g position to around 10 degrees , ( expected output be around 3800  ,(ODR=833, BDU enabled, FS=8g,)

 

Due to this      orientation calculation gives error output, please help    

Outcomes