Freescale Semiconductor MMA745xL Accelerometer Application Note
PDF
Документ
Реклама
Реклама
AN3745 Rev 0, 07/2008 Freescale Semiconductor Application Note How to Calibrate 0g Offset for the MMA745xL Family The offset can be calibrated by storing the offset values in the designated offset drift registers $10 to $15 in the accelerometer. These values will be stored here until the part loses power. It is a very simple to store these values written to the registers in the memory of a microcontroller, if used in conjunction with the sensor. This will provide automatic calibration of the sensor each time the sensor is turned back on. In order to calibrate the MMA745xL 0g offset, the predetermined digital offset values should be subtracted from the reading of the actual digital sensing values. The following procedure is a recommendation for how this can be accomplished: 1. After power up, set up the “Mode Control Register” (Register $16) to be in “measurement mode” by writing $05 into Register $16. Then read the X, Y and Z offset values from the Registers $00-$08. The first 6 registers of the 9 are 10-bit XYZ output values: LSB, first; MSB, second. Please verify with the data sheet for detailed register information. 2. In this step, the offset compensation is calculated to shift the offset to zero. For example, if the 0g offset is calibrated sitting flat (where X = 0g, Y = 0g and Z = +1g) in 2g mode (64LSB/g sensitivity), the outputs from Registers $00-$08 are the following: X = -30, Y = -20, Z = +20. In this case, • X must be shifted by +30 to get X back to zero • Y must be shifted by +20 to get to zero • Z must be shifted by (+64-20) = +44 to get to +64 (since Z is in the +1g orientation) 3. These compensation values can be written in hexadecimal into the “Offset Drift Registers” $10-$15. The Offset Drift Registers require each value to be ½ LSB, therefore the calibration values calculated in Step 2 must be multiplied by two. Note that there will still be a bit of offset shift, and you may need to multiply by a bit more than two to exactly subtract the offset. © Freescale Semiconductor, Inc., 2008. All rights reserved. Therefore, for this example, you should: • Write +60 (3C Hex) into the X drift Register $10 • Write +40 (28 Hex) into the Y drift Register $12 • Write +88 (2C Hex) into the Z drift Register, $14 In the example used above, the compensation values were all positive values. If the compensation requires negative values, remember that 2’s complement is always used in hexadecimal for storing the signed value. If you are using 10-bit mode, and the calibrated values are greater than 8 bits, then there is another register for up to 3 more bits: • Register $10 and $11 are for X • Register $12 and $13 are for Y • Register $14 and $15 are for Z These registers follow signed byte data using 2’s complement. Reading or writing low byte (X, Y or Z) OUTL latches high byte data (X, Y, or Z) OUTH to allow coherent 10-bit reads or writes. (X, Y, or Z) OUTH should be read/written directly following (X, Y or Z) OUTL. 4. After this compensation process is complete, you can continue to modify the values by overcompensating until you get the final output to be right at 0 for X and Y and at 64 for Z. Note this is an iterative process. 5. Now the calibrated values are stored in the “Offset Drift Registers”. To avoid the values being erased when the power is turned off, it is recommended to store these values in flash or a nonvolatile memory in the main processor or external to the processor. It is also recommended to include a short start-up sequence to write the compensation values stored in flash or nonvolatile memory to the registers $10-$15 in the accelerometer on start-up. If a microcontroller is used, a recursive program is available to autocalibrate the device. How to Reach Us: Home Page: www.freescale.com Web Support: http://www.freescale.com/support USA/Europe or Locations Not Listed: Freescale Semiconductor, Inc. Technical Information Center, EL516 2100 East Elliot Road Tempe, Arizona 85284 1-800-521-6274 or +1-480-768-2130 www.freescale.com/support Europe, Middle East, and Africa: Freescale Halbleiter Deutschland GmbH Technical Information Center Schatzbogen 7 81829 Muenchen, Germany +44 1296 380 456 (English) +46 8 52200080 (English) +49 89 92103 559 (German) +33 1 69 35 48 48 (French) www.freescale.com/support Japan: Freescale Semiconductor Japan Ltd. Headquarters ARCO Tower 15F 1-8-1, Shimo-Meguro, Meguro-ku, Tokyo 153-0064 Japan 0120 191014 or +81 3 5437 9125 [email protected] Asia/Pacific: Freescale Semiconductor China Ltd. Exchange Building 23F No. 118 Jianguo Road Chaoyang District Beijing 100022 China +86 10 5879 8000 [email protected] For Literature Requests Only: Freescale Semiconductor Literature Distribution Center P.O. Box 5405 Denver, Colorado 80217 1-800-441-2447 or +1-303-675-2140 Fax: +1-303-675-2150 [email protected] AN3745 Rev. 0 07/2008 Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductor products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document. Freescale Semiconductor reserves the right to make changes without further notice to any products herein. Freescale Semiconductor makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale Semiconductor assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. “Typical” parameters that may be provided in Freescale Semiconductor data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including “Typicals”, must be validated for each customer application by customer’s technical experts. Freescale Semiconductor does not convey any license under its patent rights nor the rights of others. Freescale Semiconductor products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Freescale Semiconductor product could create a situation where personal injury or death may occur. Should Buyer purchase or use Freescale Semiconductor products for any such unintended or unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2008. All rights reserved. ">
/
Завантажити
Просто дружнє нагадування. Ви можете переглянути документ прямо тут. Але найголовніше, наш штучний інтелект вже прочитав його. Він може пояснити складні речі простими словами, відповісти на ваші запитання будь-якою мовою та допомогти вам швидко орієнтуватися навіть у найдовших або найскладніших документах.
Реклама