| 数据搜索系统,热门电子元器件搜索 |
|
AN2989 数据表(PDF) 23 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN2989 数据表(HTML) 23 Page - STMicroelectronics |
|
23 / 28 page ![]() AN2989 Interrupt generation Doc ID 15761 Rev 1 23/28 5.4.2 Using the HP filter The code which follows provides a basic routine showing the practical use of the inertial wakeup feature performed on high-pass filtered data. In particular, the device is configured to recognize when the high-frequency component of the acceleration applied along either the X, Y or Z axis exceeds a preset threshold (250 mg is used in the example). The event which triggers the interrupt is latched inside the device and its occurrence is signalled through the INT1 pin. At step 8, a dummy read at the HP_FILTER_RESET register is performed to set the current/reference acceleration/tilt state against which the device performed the threshold comparison. This read may be performed any time it is required to set the orientation/tilt of the device as a reference state without waiting for the filter to settle. 5.5 Free-fall detection Free-fall detection refers to a specific configuration of the INTx_CTRL registers that allows the recognition of device free-fall: the acceleration measurements along all the axes go to zero. In real cases, a “free-fall zone” is defined around the zero-g level, where all accelerations are small enough to generate the interrupt (Figure 11). 1 write 2Fh into CTRL_REG1 // Turn on the sensor, enable X, Y and Z // ODR = 100 Hz 2 write 15h into CTRL_REG2 // High-pass filter enabled on data and interrupt1 3 write 00h into CTRL_REG3 // Latched interrupt active high on INT1 pad 4 write 00h into CTRL_REG4 // FS = 2 g 5 write 00h into CTRL_REG5 // Sleep to wake disabled 6 write10h into INT1_THS // Threshold = 250 mg 7 write 00h into INT1_DURATION // Duration = 0 8 read HP_FILTER_RESET // Dummy read to force the HP filter to // actual acceleration value // (i.e. set reference acceleration/tilt value) 9 write 2Ah into INT1_CFG // Configure desired wakeup event 10 poll INT1 pad; if INT1 = 0 then goto 9 // Poll INT1 pin waiting for the // wakeup event 11 (Wakeup event has occurred; insert your code here) // Event handling 12 read INT1_SRC // Return the event that has triggered the // interrupt and clear interrupt 13 (Insert your code here) // Event handling 14 goto 9 |
|
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |