Electronic Components Datasheet Search
  English  ▼

X  

AN4159 Datasheet(PDF) 24 Page - STMicroelectronics

Part # AN4159
Description  Hardware and software guidelines for use of the LPS331AP
PDF  27 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

AN4159 Datasheet(HTML) 24 Page - STMicroelectronics

Back Button AN4159 Datasheet HTML 19Page - STMicroelectronics AN4159 Datasheet HTML 20Page - STMicroelectronics AN4159 Datasheet HTML 21Page - STMicroelectronics AN4159 Datasheet HTML 22Page - STMicroelectronics AN4159 Datasheet HTML 23Page - STMicroelectronics AN4159 Datasheet HTML 24Page - STMicroelectronics AN4159 Datasheet HTML 25Page - STMicroelectronics AN4159 Datasheet HTML 26Page - STMicroelectronics AN4159 Datasheet HTML 27Page - STMicroelectronics  
Zoom Inzoom in Zoom Outzoom out
 24 / 27 page
background image
Software
AN4159
24/27
Doc ID 023639 Rev 3
Case 12:
“How is the pressure variation threshold interrupt activated?”
●
We assume in the explanation that the registers in RIF_PAS (@3C, 3D, 3E) are not
used in the application.
Mechanism:
First, differential mode must be activated (DIFF_EN=1)
Second, program the reference pressure in REF_P register (for example, copy the
current P_OUT value to REF_P registers).
Caution: P_OUT is the measured ADC pressure minus the REF_P, so at this point all
the future P_OUT measurements should be near 0 mb. To keep track of the absolute
pressure, the SW in the host should remember REF_P and add it back to P_OUT.
Third, program the threshold THS register (1 LSB = 1/16 mb step). This defines the
pressure band: When P_OUT absolute difference exceed THS value, and interrupt will
be generated.
Fourth: Configure the INT pin and the type of interrupt needed.
Source code example:
u8 LPS331AP_ActivatePressureBand(u16 Threshold_mb_x16)
{
u8 reg;
u8 regs[4];
// Warning: this can only be done if the 1 point calibration HW feature is
unused
reg = LPS331AP_ReadByte(LPS331AP_CTRL_REG1_ADDR);
if(reg & 0x02)
return FALSE;
// if DIFF_EN bit is set, to clear it, and increase
LPS331AP_Adjust_Value_Pressure_Reg by the DELTA_PRESS value.
LPS331AP_WriteByte(LPS331AP_CTRL_REG1_ADDR, reg | 0x08); // activate the
delta pressure logic
LPS331AP_Read(regs,LPS331AP_PRESS_OUT_ADDR,3);// no reading back of REF_P
required.
LPS331AP_Write(regs,LPS331AP_REF_P_ADDR,3);
LPS331AP_Adjust_Value_Pressure_Reg = ((u32)regs[2])<<16;
LPS331AP_Adjust_Value_Pressure_Reg |= ((u32)regs[1])<<8;
LPS331AP_Adjust_Value_Pressure_Reg |= regs[0];
LPS331AP_Adjust_Value_Pressure_Reg =~LPS331AP_Adjust_Value_Pressure_Reg;
// now activate the delta pressure logic
LPS331AP_WriteByte(LPS331AP_THS_P_ADDR,Threshold_mb_x16); // LSB Threshold
LPS331AP_WriteByte(LPS331AP_THS_P_ADDR+1,Threshold_mb_x16>>8); // MSB
Threshold
LPS331AP_WriteByte(LPS331AP_INTERRUPT_CONFIG_ADDR,0x03); // write 0x07 if
you want the interrupt output to stop by reading INT_SOURCE Reg



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27


Datasheet Download

Go To PDF Page


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


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
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