2017-12-21 05:24 PM
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 ofREFERENCE is 0. but actually the IA interrupt always occured. How to resolve it?Thanks!