cancel
Showing results for 
Search instead for 
Did you mean: 

How to use tilt remedy with LIS3DH sensor

dehai wo
Associate II
Posted on December 22, 2017 at 02:24

Now I want achieve tilt remedy function. I did as the following:

1,tilt the sensor with a constant angle.

2, In initialization function:

set ODR,set mode nomal ,set full scale(+/-2g),enable x,y,z axis,

set LIS3DH_CTRL_REG2=0x48 ( HPM[1:0]=[01],Reference signal for filtering),set REFERENCE =0;

set THR = 2。enable X and Y interrupt . enable IA1 to INT1 .

3, In tilt remedy function:

check IA interrupt flag;

if IA interrupt occured , set THR with THR+1.

loop up line until interrupt not occured.

set the REFERENCE regesiter with the value of current THR ,

resume the THR register with value 2.

by now , IA interrupt should not occured. because the the difference between the input acceleration and the content of

REFERENCE is 0. but actually the IA interrupt always occured. How to resolve it?

Thanks!

0 REPLIES 0