Example: tourism industry

AN4076, Data Manipulation and Basic Settings of …

2010, 2011 Freescale Semiconductor, Inc. All rights Number: AN4076 Rev 1, 02/2012 Freescale Semiconductor Application NoteData Manipulation and Basic Settings of the MMA8451, 2, 3 Qby: Kimberly Tuck Applications is important to understand how to program the MMA8451, 2, 3Q to extract and manipulate the acceleration data . These devices have been designed to be compatible with a shared memory map. For details on the differences of the embedded features please review our selector guide. The mma8451q has the most embedded features which include eight different sample rates, 32 different cutoff frequencies for the high-pass filter, Three dynamic ranges and four oversampling modes. It also has a 32 sample FIFO for collecting and storing data , which is the most efficient way to access the data for minimizing the I2C transactions.

AN4076. Sensors Freescale Semiconductor, Inc. 3. 2.1 Output Data, Sample Rates and Dynamic Ranges of all Three Products. 2.1.1 MMA8451Q . 1. 14-bit data

Tags:

  Basics, Data, Testing, Manipulation, Data manipulation and basic settings, Mma8451q

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of AN4076, Data Manipulation and Basic Settings of …

1 2010, 2011 Freescale Semiconductor, Inc. All rights Number: AN4076 Rev 1, 02/2012 Freescale Semiconductor Application NoteData Manipulation and Basic Settings of the MMA8451, 2, 3 Qby: Kimberly Tuck Applications is important to understand how to program the MMA8451, 2, 3Q to extract and manipulate the acceleration data . These devices have been designed to be compatible with a shared memory map. For details on the differences of the embedded features please review our selector guide. The mma8451q has the most embedded features which include eight different sample rates, 32 different cutoff frequencies for the high-pass filter, Three dynamic ranges and four oversampling modes. It also has a 32 sample FIFO for collecting and storing data , which is the most efficient way to access the data for minimizing the I2C transactions.

2 The FIFO can collect the regular low-pass filtered data as well as the data from the high-pass filter. The Manipulation of the data into different formats is important for algorithm development and for display. This application note accompanies the MMA8451, 2, 3Q Driver Code and will explain the following: Changing the operational modes (Standby, Active 2g, Active 4g and Active 8g) Changing Oversampling Modes Changing the data Rate Changing the High-Pass Filter Cutoff Frequency 8-bit data vs. 14/12/10-bit data Changing data Formats (hex to counts to decimal numbers) Streaming XYZ data polling vs. Streaming XYZ data with interrupts Using the FIFO in the WordsAccelerometer, Output data Rate, Standby Mode, Active Mode, High-Pass Filter Cutoff Frequency, 8-bit data , 14-bit data , 12-bit data , 10-bit data Hexadecimal Numbers, Decimal Numbers, data Formats, Streaming data , Counts, Polling, Interrupts, FIFO data , Flush, Sensor Toolbox Demo Board, Driver Code, High-Pass Filtered data , Low-Pass Filtered DataTABLE OF Introduction.

3 Key Words .. Summary .. MMA845xQ Consumer 3-axis Accelerometer 3 by 3 by 1 mm .. Output data , Sample Rates and Dynamic Ranges of all Three Products .. mma8451q .. MMA8452Q .. MMA8453Q Note: No HPF data .. Changing Modes of the MMA8451, 2, 3Q .. Standby and Active Mode .. 2g Active Mode .. 4g Active Mode .. 8g Active Mode .. Setting the data Rate .. Setting the Oversampling Mode .. Setting the High-Pass Filter Cutoff Frequency .. High-Pass Filtered data or Low-Pass Filtered data .. 14-bit, 12-bit or 10-bit data Streaming and data Conversions.. Converting 14-bit 2 s Complement Hex Number to Signed Integer (Counts) .. Converting 14-bit 2 s Complement Hex Number to Signed Decimal Fraction in g s.

4 2g Active Mode .. 4g Active Mode .. 8g Active Mode .. 8-bit XYZ data Streaming and Conversions .. Converting 8-bit 2 s Complement Hex Number to Signed Integer Number .. Converting 8-bit 2 s Complement Hex Number to Signed Decimal Fraction in g s .. 2g Active Mode .. Polling data vs. Interrupts .. Polling data .. Interrupt Routine to Access data .. Using the 32 Sample FIFO .. 21AN4076 Sensors 2 Freescale Semiconductor, There is a Standby Mode which responds to I2C communication but doesn t allow for updated data . There are also three dynamic ranges: 2g, 4g and 8g which can be used to observe the change in sensitivity and full acceleration range while the device is active. B. An example of how to set the data rate is shown.

5 There are eight different data rates ranging from Hz to 800 Hz. C. An example of how to set the High-Pass Filter Cutoff Frequency is given. The high-pass filtered output data is affected by the filter cutoff frequency There are four different oversampling modes that can be An example and the format conversions for manipulating 14/12/10/8-bit data converting 2 s complement hex data to two different formats, which include formatting to signed integer (counts) and signed decimal fractions in g s for high-pass filtered data or low-pass filtered An example of how to set up the device to poll the data or configure an interrupt service routine is An example of how to configure the FIFO to store and flush There is a driver available that will run on the MMA8451, 2, 3Q Sensor Toolbox Demo Board that provides an example in CodeWarrior for everything discussed in the application note.

6 The driver runs in RealTerm or HyperTerminal and can be used to capture and log data in different MMA845xQ Consumer 3-axis Accelerometer 3 by 3 by 1 mmThe MMA8451, 2, 3Q has a selectable dynamic range of 2g, 4g, 8g. The device has 8 different output data rates, selectable high-pass filter cutoff frequencies, and in some cases high-pass filtered output data available. The resolution of the data and the embedded features is dependant on the specific device. Note: The MMA8451, 2, 3Q has a different memory map than that of the 1. MMA8451, 2, 3Q Consumer 3-axis Accelerometer 3 mm by 3 mm by 1 mm12345910111213141516876 NCVDDNCVDDIOBYPNCSCLGNDNCGNDINT1 GNDINT2SA0 NCSDAMMA845xQ16-Pin QFN(Top View)AN4076 Sensors Freescale Semiconductor, data , Sample Rates and Dynamic Ranges of all Three 1.

7 14-bit data2g (4096 counts/g = mg/LSB) 4g (2048 counts/g = mg/LSB) 8g (1024 counts/g = 1 mg/LSB)2. 8-bit data 2g (64 counts/g = mg/LSB) 4g (32 counts/g = mg/LSB) 8g (16 counts/g = mg/LSB)3. Embedded 32 sample FIFO ( mma8451q ) 1. 12-bit data2g (1024 counts/g = 1 mg/LSB) 4g (512 counts/g = 2 mg /LSB) 8g (256 counts/g = mg/LSB)2. 8-bit data2g (64 counts/g = mg/LSB) 4g (32 counts/g = mg/LSB) 8g (16 counts/g = mg/LSB) Note: No HPF Data1. 10-bit data2g (256 counts/g = mg/LSB) 4g (128 counts/g = mg/LSB) 8g (64 counts/g= mg/LSB)2. 8-bit data2g (64 counts/g = mg/LSB) 4g (32 counts/g = mg/LSB) 8g (16 counts/g = mg/LSB) Changing Modes of the MMA8451, 2, 3 QThe device can be in either Standby Mode or Active Mode.

8 Most of the Settings are changed in Standby Mode but the data does not update and is not enabled until the device is in Active Mode. There are also 3 different dynamic ranges that can be set (2g, 4g, 8g). The dynamic range is changeable only in the Standby Mode. The dynamic range is controlled by setting the FS0 and FS1 bits in register 0x0E. The device changes from Standby to Active Mode via bit 0 in register 1. 0x2A CTRL_REG1 Register (Read/Write)Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 ASLP_RATE1 ASLP_RATE0DR2DR1DR0 LNOISEFREADACTIVET able 2. 0x0E XYZ_DATA_CFG Register (Read/Write)Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 00 0 HPF_Out0 0FS1FS0 Table 3. Full Scale SelectionFS1FS0g Range00 2g01 4g10 8g11 AN4076 Sensors 4 Freescale Semiconductor, and Active ModeMost, although not quite all changes to the registers must be done while the accelerometer is in Standby Mode.

9 Current con-sumption in Standby Mode is typically 1 - 2 A. To be in Standby Mode the last bit of CTRL_REG1 must be cleared (Active = 0). When Active = 1 the device is in the active Example:void MMA845x_Standby (void){byte n;/** Read current value of System Control 1 Register.** Put sensor into Standby Mode by clearing the Active bit** Return with previous value of System Control 1 Register.*/n = IIC_RegRead(CTRL_REG1);IIC_RegWrite(CTRL _REG1, n & ~ACTIVE_MASK); }void MMA845x_Active (){/** Set the Active bit in CTRL Reg 1*/IIC_RegWrite(CTRL_REG1, (IIC_RegRead(CTRL_REG1) | ACTIVE_MASK));} Active ModeIn order to enter 2g Active Mode, the MMA8451, 2, 3Q must first be put into Standby Mode prior to changing the FS bits to 00 (as per Ta b l e 3). Code Example:/**Put the part in Standby Mode*/MMA845x_Standby();/* **Write the 2g dynamic range value into register 0x0E*/IIC_RegWrite(XYZ_DATA_CFG_REG, (IIC_RegRead(XYZ_DATA_CFG_REG) & ~FS_MASK));/**Put the part back into the Active Mode*/MMA845x_Active(); Active ModeIn order to enter 4g Active Mode, the MMA8451, 2, 3Q must first be put into Standby Mode prior to changing the FS bits 01 (as per Ta b l e 3).

10 Code Example:/**Put the part in Standby Mode*/MMA845x_Standby();/* **Write the 4g dynamic range value into register 0x0E*/IIC_RegWrite(XYZ_DATA_CFG_REG, (IIC_RegRead(XYZ_DATA_CFG_REG) & ~FS_MASK));IIC_RegWrite(XYZ_DATA_CFG_REG , (IIC_RegRead(XYZ_DATA_CFG_REG) | FULL_SCALE_4G));/**Put the part back into the Active Mode*/MMA845x_Active();AN4076 Sensors Freescale Semiconductor, Active ModeIn order to enter 8g Active Mode, the MMA8451, 2, 3Q must first be put into Standby Mode prior to changing the FS bits to 10 (as per Ta b l e 3). Code Example:/**Put the part in Standby Mode*/MMA845x_Standby();/* **Write the 8g dynamic range value into register 0x0E*/IIC_RegWrite(XYZ_DATA_CFG_REG, (IIC_RegRead(XYZ_DATA_CFG_REG) & ~FS_MASK));IIC_RegWrite(XYZ_DATA_CFG_REG , (IIC_RegRead(XYZ_DATA_CFG_REG) | FULL_SCALE_8G));/**Put the part back into the Active Mode*/MMA845x_Active(); Setting the data RateThe active mode Output data Rate (ODR) and Sleep Mode data Rate are programmable via other control bits in the CTRL_REG1 register, seen in Table 4.


Related search queries