| Electronic Components Datasheet Search |
|
AN2381 Datasheet(PDF) 43 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN2381 Datasheet(HTML) 43 Page - STMicroelectronics |
|
43 / 47 page ![]() AN2381 Application information 43/47 The code sample exploits a threshold set at 350mg for free-fall recognition and the event is notified by the hardware signal RDY/INT. At step 6, the FF_WU_DURATION register is configured so to ignore events that are shorter than 5/DR=5/160~30msec (DR=data rate; see Table 7.) in order to avoid false detections. Once the free-fall event has occurred, a dummy read at FF_WU_ACK reg clears the request and the device is ready to recognize other events. 6.7 Direction detection The code disclosed below illustrates the ability of the LIS3LV02DL device to recognize in which direction it has been tilted and to flag a change in its orientation/tilt with respect to the previous state through the hardware RDY/INT signal. In the example below the device is configured to detect tilt which exceed 260mg (set as external/outer threshold), while the internal/inner threshold is set, as an example, to 150mg. At step 8, a dummy read at HP_FILTER_RESET register is performed to set the current acceleration/tilt as a reference state value for 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. 1 write C7h into CTRL_REG1 // Turn on the sensor and set DF=512 2 write 08h into CTRL_REG2 // Enables interrupt generation 3 write 4Bh into CTRL_REG3 // Enable the HP filter and force HPc=4096 4 write A3h into DD_THSE_L register // Set the lower part of outer threshold 5 write 10h into DD_THSE_H register // Set the higher part of outer threshold 6 write 99h into DD_THSI_L register // Set the lower part of inner threshold 7 write 09h into DD_THSI_H register // Set the higher part of inner threshold 8 read HP_FILTER_RESET register // Dummy read to force the HP filter to // actual acceleration value // (i.e. set reference acceleration/tilt value) 9 write CFh into DD_CFG register // Configure direction detection along // X and Y axes 10 poll RDY/INT pad; if RDY/INT=0 then goto 10 // Poll RDY/INT pin waiting for a direction // change event 11 (Direction/tilt has changed; insert your code here) // Event handling 12 read DD_SRC register // Return the direction in which the tilt // has occurred 13 (Insert your code here) // Event handling 14 read DD_ACK register // Clear interrupt request (on direction // change) 15 goto 10 |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List 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 |