Freescale Semiconductor FRDM-FXS-MULTI-B Data Sheet
MPL3115A2
Sensors
10
Freescale Semiconductor, Inc.
4
Quick Start Setup
To set up the part in Altimeter mode, you may select your data retrieval method between polling (no FIFO), interrupt (no FIFO)
or with the FIFO.
describes the setup for polling or interrupt with an OSR of 128.
describes the FIFO setup
with an OSR of 128.
See the application note titled Data Manipulation and Basic Settings of the MPL3115A2 Command Line Interface (document
AN4519).
Figure 5. Polling or Interrupt - No FIFO
Check for interrupt
on pin INT2
Poll data or use
interrupt INT2
Yes
Polling
/* Is SRC_DRDY Set */
(INT_S & 0x80) == TRUE
Service interrupt
and clear
Yes
No
Yes
No
Interrupt
/* Enable DRDY Interrupt */
IIC_RegWrite(SlaveAddressIIC, 0x29, 0x80);
/* Set Active */
IIC_RegWrite(SlaveAddressIIC, 0x26, 0xB9);
/* Enable Data Flags in PT_DATA_CFG */
IIC_RegWrite(SlaveAddressIIC, 0x13, 0x07);
/* I2C Address is 0xC0 */
SlaveAddressIIC = 0xC0
SlaveAddressIIC = 0xC0
/* Set Active */
IIC _RegWrite(SlaveAddressIIC, 0x26, 0xB9);
/* Read STATUS Register */
STA = IIC _RegRead(SlaveAddressIIC, 0x00);
/* Is Data Ready */
(STA & 0x08) == TRUE
/* Read INT_SOURCE */
INT_S = IIC _RegRead(SlaveAddressIIC, 0x12);
/* Read OUT_P and OUT_T */
/* This clears the DRDY Interrupt */
OUT_P_MSB = IIC_RegRead(SlaveAddressIIC, 0x01);
OUT_P_CSB = IIC_RegRead(SlaveAddressIIC, 0x02);
OUT_P_LSB = IIC_RegRead(SlaveAddressIIC, 0x03);
OUT_T_MSB = IIC_RegRead(SlaveAddressIIC, 0x04);
OUT_T_LSB = IIC_RegRead(SlaveAddressIIC, 0x05);
Clear Interrupt
/* Read OUT_P and OUT_T */
/* This clears the DRDY Interrupt */
OUT_P_MSB = IIC_RegRead(SlaveAddressIIC, 0x01);
OUT_P_CSB = IIC_RegRead(SlaveAddressIIC, 0x02);
OUT_P_LSB = IIC_RegRead(SlaveAddressIIC, 0x03);
OUT_T_MSB = IIC_RegRead(SlaveAddressIIC, 0x04);
OUT_T_LSB = IIC_RegRead(SlaveAddressIIC, 0x05);
/* Set to Altimeter with an OSR = 128 */
IIC_RegWrite(SlaveAddressIIC, 0x26, 0xB8);
/* Set INT to Active Low Open Drain */
IIC_RegWrite(SlaveAddressIIC, 0x28, 0x11);
No