MMA8451Q - Bare metal example project

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MMA8451Q - Bare metal example project

MMA8451Q - Bare metal example project

Hi Everyone,

As I am frequently asked for a simple bare metal example code for the Xtrinsic MMA8451Q digital accelerometer, I would like to share here one of my examples I have created for this part while working with the Freescale FRDM-KL25Z platform.

This example illustrates:

1. Initialization of the MKL25Z128 MCU (mainly I2C and PORT modules).

2. Initialization of the accelerometer to achieve the highest resolution.

3. Simple offset calibration based on the AN4069.

4. Output data reading using an interrupt technique.

5. Conversion of the output values from registers 0x01 – 0x06 to real acceleration values in g’s.

6. Visualization of the output values in the FreeMASTER tool.

1. According to the schematic, the INT1 output of the MMA8451Q is connected to the PTA14 pin of the KL25Z MCU and both SCL and SDA lines are connected to the I2C0 module (PTE24 and PTE25 pins). The MCU is, therefore, configured as follows:

void MCU_Init(void)

{

     //I2C0 module initialization

     SIM_SCGC4 |= SIM_SCGC4_I2C0_MASK;        // Turn on clock to I2C0 module

     SIM_SCGC5 |= SIM_SCGC5_PORTE_MASK;       // Turn on clock to Port E module

     PORTE_PCR24 = PORT_PCR_MUX(5);           // PTE24 pin is I2C0 SCL line

     PORTE_PCR25 = PORT_PCR_MUX(5);           // PTE25 pin is I2C0 SDA line

     I2C0_F  = 0x14;                          // SDA hold time = 2.125us, SCL start hold time = 4.25us, SCL stop hold time = 5.125us *

     I2C0_C1 = I2C_C1_IICEN_MASK;             // Enable I2C0 module

 

        //Configure the PTA14 pin (connected to the INT1 of the MMA8451Q) for falling edge interrupts

     SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK;       // Turn on clock to Port A module

     PORTA_PCR14 |= (0|PORT_PCR_ISF_MASK|     // Clear the interrupt flag

                       PORT_PCR_MUX(0x1)|     // PTA14 is configured as GPIO

                       PORT_PCR_IRQC(0xA));   // PTA14 is configured for falling edge interrupts

 

        //Enable PORTA interrupt on NVIC

     NVIC_ICPR |= 1 << ((INT_PORTA - 16)%32);

     NVIC_ISER |= 1 << ((INT_PORTA - 16)%32);

}

2. At the beginning of the initialization, all accelerometer registers are reset to their default values by setting the RST bit of the CTRL_REG2 register. The dynamic range is set to ±2g and to achieve the highest resolution, the LNOISE bit is set and the lowest ODR (1.56Hz) and the High Resolution mode are selected (more details in AN4075).

void Accelerometer_Init (void)

{

     unsigned char reg_val = 0;

 

     I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG2, 0x40);           // Reset all registers to POR values

         do            // Wait for the RST bit to clear

     {

        reg_val = I2C_ReadRegister(MMA845x_I2C_ADDRESS, CTRL_REG2) & 0x40;

     }  while (reg_val);

 

     I2C_WriteRegister(MMA845x_I2C_ADDRESS, XYZ_DATA_CFG_REG, 0x00);    // +/-2g range -> 1g = 16384/4 = 4096 counts

     I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG2, 0x02);           // High Resolution mode

     I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG1, 0x3D);           // ODR = 1.56Hz, Reduced noise, Active mode  

}

3. A simple offset calibration method is implemented according to the AN4069. At the end of the calibration routine, the DRDY interrupt is enabled and routed to the INT1 interrupt pin that is configured to be a push-pull, active-low output.

void Calibrate (void)

{

     unsigned char reg_val = 0;

 

         while (!reg_val)           // Wait for a first set of data         

     {

        reg_val = I2C_ReadRegister(MMA845x_I2C_ADDRESS, STATUS_REG) & 0x08;

     }

        

     I2C_ReadMultiRegisters(MMA845x_I2C_ADDRESS, OUT_X_MSB_REG, 6, AccData);           // Read data output registers 0x01-0x06

                                          

     Xout_14_bit = ((short) (AccData[0]<<8 | AccData[1])) >> 2;           // Compute 14-bit X-axis output value

     Yout_14_bit = ((short) (AccData[2]<<8 | AccData[3])) >> 2;           // Compute 14-bit Y-axis output value

     Zout_14_bit = ((short) (AccData[4]<<8 | AccData[5])) >> 2;           // Compute 14-bit Z-axis output value

                                   

     Xoffset = Xout_14_bit / 8 * (-1);        // Compute X-axis offset correction value

     Yoffset = Yout_14_bit / 8 * (-1);        // Compute Y-axis offset correction value

     Zoffset = (Zout_14_bit - SENSITIVITY_2G) / 8 * (-1);          // Compute Z-axis offset correction value

                                   

     I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG1, 0x00);             // Standby mode to allow writing to the offset registers 

     I2C_WriteRegister(MMA845x_I2C_ADDRESS, OFF_X_REG, Xoffset);        

     I2C_WriteRegister(MMA845x_I2C_ADDRESS, OFF_Y_REG, Yoffset); 

     I2C_WriteRegister(MMA845x_I2C_ADDRESS, OFF_Z_REG, Zoffset); 

     I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG3, 0x00);             // Push-pull, active low interrupt

     I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG4, 0x01);             // Enable DRDY interrupt

     I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG5, 0x01);             // DRDY interrupt routed to INT1 - PTA14

     I2C_WriteRegister(MMA845x_I2C_ADDRESS, CTRL_REG1, 0x3D);             // ODR = 1.56Hz, Reduced noise, Active mode 

}

4. In the ISR, only the interrupt flag is cleared and the DataReady variable is set to indicate the arrival of new data.

void PORTA_IRQHandler()

{

     PORTA_PCR14 |= PORT_PCR_ISF_MASK;            // Clear the interrupt flag

     DataReady = 1;     

}

5. The output values from accelerometer registers 0x01 – 0x06 are first converted to signed 14-bit values and afterwards to real values in g’s.

if (DataReady)             // Is a new set of data ready?

{           

     DataReady = 0;

                                                                                                               

     I2C_ReadMultiRegisters(MMA845x_I2C_ADDRESS, OUT_X_MSB_REG, 6, AccData);           // Read data output registers 0x01-0x06

      

     Xout_14_bit = ((short) (AccData[0]<<8 | AccData[1])) >> 2;           // Compute 14-bit X-axis output value

     Yout_14_bit = ((short) (AccData[2]<<8 | AccData[3])) >> 2;           // Compute 14-bit Y-axis output value

     Zout_14_bit = ((short) (AccData[4]<<8 | AccData[5])) >> 2;           // Compute 14-bit Z-axis output value

               

     Xout_g = ((float) Xout_14_bit) / SENSITIVITY_2G;              // Compute X-axis output value in g's

     Yout_g = ((float) Yout_14_bit) / SENSITIVITY_2G;              // Compute Y-axis output value in g's

     Zout_g = ((float) Zout_14_bit) / SENSITIVITY_2G;              // Compute Z-axis output value in g's                                  

}

6. The calculated values can be watched in the "Variables" window on the top right of the Debug perspective or in the FreeMASTER application. To view both the 14-bit and real values in the FreeMASTER application, some USBDM drivers need to be first installed on your computer. They are available for download from SourceForge. Erich Styger described their installation in this tutorial. In addition to that, the USBDM_OpenSDA application that provides both debugging and a virtual serial port needs to be loaded into the MK20 debugger chip on the FRDM-KL25Z board. This installation follows the usual FRDM-KL25Z bootloader process:

  • Unplug the FRDM-KL25Z board.
  • Whilst holding the SW1/RST switch depressed plug in the FRDM-KL25Z board. The green LED should start blinking at a rate of about 1Hz.
  • Open a file explorer and locate the USB drive that has now appeared. It will have the drive name "BOOTLOADER".
  • Drag the file USBDM_OpenSDA.sx to the USB drive and wait a short while. The OpenSDA firmware on the FRDM-KL25Z board will program the USBDM firmware into the MK20 debugger chip on the board.
  • Remove and re-plug the FRDM-KL25Z board. The board will now appear as a USBDM device.

FRDM-KL25Z_MMA8451Q_BasicReadUsingInterrupt_HighResolution.JPG.jpg

FRDM-KL25Z_MMA8451Q_BasicReadUsingInterrupt_HighResolution_FreeMASTER.JPG.jpg

Attached you can find the complete source code written in the CW for MCU's v10.5 as well as the FreeMASTER project.

So make it, test it and keep in touch...

Regards,

Tomas

Labels (1)
Attachments
Comments

Hi,

I am using MMA8451Q in KL25Z board with Code Warrior 10.6 (processor expert). I have configured the board for transient detection but i was not able to generate the interrupt when the amplitude goes beyond threshold level. Is there any component that helps to write the ISR for the interrupt generated on PTA14.

Regards,

Charan

Hi Charan,

You might find useful my example code for the embedded transient detection function that is available here.

I hope it helps.

Regards,

Tomas

Hi Tomas,

thank you very much for your replay and It worked.

Regards,

Charan

Hi Tomas,

I tried your code on board FRDM KL43z. The difference between it and KL25z is that the pin INT1 is the pin PTC5. I tested initially communicate, therefore I read WHOIAM register (0x0D), but returns me sign 0xFF, but interesting is that once function return correct character 0x1A, but after restart again return 0xFF. Where could be a problem?

Thanks.

Hi Martin,

Since the FRDM-KL43Z board does not have both the communication pins (PTE24 – I2C0 SCL and PTE25 – I2C0 SDA) easily accessible to see what is going on on the I2C bus, it is hard to say where the problem might be. The MKL43Z256 MCU is not supported in the CW for MCU’s v10.6, so I have created another project in KDS 3.0.0 using KSDK 1.2.0 and Processor Expert. You can find it attached above in my original post.

Hope it helps.

Regards,

Tomas

Hi Tomas,

I´m not able to watch the variables at Freemaster (I´m new using this tool) and I don´t see its libraries, functions, etc. from your souce code, so how the application communicate with Freemaster and how to embedded in a new baremetal project?

Hi Tomas,
is there any chance you could upload your projects again as they're unfortunately deleted from NXP sites. Working on MMA8451Q with KL46Z and got hard stuck. Can't get ack after sending my address to I2C. I would really appreciate. I know it's been a long time since you posted this. 

%3CLINGO-SUB%20id%3D%22lingo-sub-1127268%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EMMA8451Q%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1127268%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Everyone%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3EAs%20I%20am%20frequently%20asked%20for%20a%20simple%20bare%20metal%20example%20code%20for%20the%20%3CA%20href%3D%22http%3A%2F%2Fwww.freescale.com%2Fwebapp%2Fsps%2Fsite%2Fprod_summary.jsp%3Fcode%3DMMA8451Q%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EXtrinsic%20MMA8451Q%20digital%20accelerometer%3C%2FA%3E%2C%20I%20would%20like%20to%20share%20here%20one%20of%20my%20examples%20I%20have%20created%20for%20this%20part%20while%20working%20with%20the%20Freescale%20%3CA%20href%3D%22http%3A%2F%2Fwww.freescale.com%2Fwebapp%2Fsps%2Fsite%2Fprod_summary.jsp%3Fcode%3DFRDM-KL25Z%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EFRDM-KL25Z%20platform%3C%2FA%3E.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3EThis%20example%20illustrates%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3E1.%20Initialization%20of%20the%20MKL25Z128%20MCU%20(mainly%20I2C%20and%20PORT%20modules).%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3E2.%20Initialization%20of%20the%20accelerometer%20to%20achieve%20the%20highest%20resolution.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3E3.%20Simple%20offset%20calibration%20based%20on%20the%20%3CA%20href%3D%22http%3A%2F%2Fwww.freescale.com%2Ffiles%2Fsensors%2Fdoc%2Fapp_note%2FAN4069.pdf%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EAN4069%3C%2FA%3E.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3E4.%20Output%20data%20reading%20using%20an%20interrupt%20technique.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3E5.%20Conversion%20of%20the%20output%20values%20from%20registers%200x01%20%E2%80%93%200x06%20to%20real%20acceleration%20values%20in%20g%E2%80%99s.%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3E6.%20Visualization%20of%20the%20output%20values%20in%20the%20%3CA%20href%3D%22http%3A%2F%2Fwww.freescale.com%2Fwebapp%2Fsps%2Fsite%2Fprod_summary.jsp%3Fcode%3DFREEMASTER%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EFreeMASTER%20tool%3C%2FA%3E.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E1.%20According%20to%20the%20%3CA%20href%3D%22http%3A%2F%2Fcache.freescale.com%2Ffiles%2Fsoft_dev_tools%2Fhardware_tools%2Fschematics%2FFRDM-KL25Z_SCH_REV_E.pdf%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Eschematic%3C%2FA%3E%2C%20the%20INT1%20output%20of%20the%20MMA8451Q%20is%20connected%20to%20the%20PTA14%20pin%20of%20the%20KL25Z%20MCU%20and%20both%20SCL%20and%20SDA%20lines%20are%20connected%20to%20the%20I2C0%20module%20(PTE24%20and%20PTE25%20pins).%20The%20MCU%20is%2C%20therefore%2C%20configured%20as%20follows%3A%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Evoid%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%3CSTRONG%3EMCU_Init%3C%2FSTRONG%3E(%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Evoid%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E)%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%233f7f5f%3B%20font-family%3A%20Consolas%3B%20font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2FI2C0%20module%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%233f7f5f%3B%20font-family%3A%20Consolas%3B%20font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3Einitialization%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20SIM_SCGC4%20%7C%3D%20SIM_SCGC4_I2C0_MASK%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Turn%20on%20clock%20to%20I2C0%20module%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20SIM_SCGC5%20%7C%3D%20SIM_SCGC5_PORTE_MASK%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Turn%20on%20clock%20to%20Port%20E%20module%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20PORTE_PCR24%20%3D%20PORT_PCR_MUX(5)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20PTE24%20pin%20is%20I2C0%20SCL%20line%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20PORTE_PCR25%20%3D%20PORT_PCR_MUX(5)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20PTE25%20pin%20is%20I2C0%20SDA%20line%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2C0_F%26nbsp%3B%20%3D%200x14%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20SDA%20hold%20time%20%3D%202.125us%2C%20SCL%20start%20hold%20time%20%3D%204.25us%2C%20SCL%20stop%20hold%20time%20%3D%205.125us%20*%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2C0_C1%20%3D%20I2C_C1_IICEN_MASK%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Enable%20I2C0%20module%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%20%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2FConfigure%20the%20PTA14%20pin%20(connected%20to%20the%20INT1%20of%20the%20MMA8451Q)%20for%20falling%20edge%20interrupts%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20SIM_SCGC5%20%7C%3D%20SIM_SCGC5_PORTA_MASK%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Turn%20on%20clock%20to%20Port%20A%20module%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20PORTA_PCR14%20%7C%3D%20(0%7CPORT_PCR_ISF_MASK%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Clear%20the%20interrupt%20flag%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20PORT_PCR_MUX(0x1)%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20PTA14%20is%20configured%20as%20GPIO%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20PORT_PCR_IRQC(0xA))%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20PTA14%20is%20configured%20for%20falling%20edge%20interrupts%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%20%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2FEnable%20PORTA%20interrupt%20on%20NVIC%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20NVIC_ICPR%20%7C%3D%201%20%26lt%3B%26lt%3B%20((%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%230000c0%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CEM%3EINT_PORTA%3C%2FEM%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20-%2016)%2532)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20NVIC_ISER%20%7C%3D%201%20%26lt%3B%26lt%3B%20((%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%230000c0%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CEM%3EINT_PORTA%3C%2FEM%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20-%2016)%2532)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E2.%20At%20the%20beginning%20of%20the%20initialization%2C%20all%20accelerometer%20registers%20are%20reset%20to%20their%20default%20values%20by%20setting%20the%20RST%20bit%20of%20the%20CTRL_REG2%20register.%20The%20dynamic%20range%20is%20set%20to%20%C2%B12g%20and%20to%20achieve%20the%20highest%20resolution%2C%20the%20LNOISE%20bit%20is%20set%20and%20the%20lowest%20ODR%20(1.56Hz)%20and%20the%20High%20Resolution%20mode%20are%20selected%20(more%20details%20in%20%3CA%20href%3D%22http%3A%2F%2Fwww.freescale.com%2Ffiles%2Fsensors%2Fdoc%2Fapp_note%2FAN4075.pdf%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EAN4075%3C%2FA%3E).%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Evoid%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%3CSTRONG%3EAccelerometer_Init%3C%2FSTRONG%3E%20(%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Evoid%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E)%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20unsigned%3C%2FSTRONG%3E%3C%2FSPAN%3E%20%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Echar%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20reg_val%20%3D%200%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%20%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2C_WriteRegister(MMA845x_I2C_ADDRESS%2C%20CTRL_REG2%2C%200x40)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Reset%20all%20registers%20to%20POR%20values%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Edo%3C%2FSTRONG%3E%3C%2FSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Wait%20for%20the%20RST%20bit%20to%20clear%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20reg_val%20%3D%20I2C_ReadRegister(MMA845x_I2C_ADDRESS%2C%20CTRL_REG2)%20%26amp%3B%200x40%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Ewhile%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20(reg_val)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%20%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2C_WriteRegister(MMA845x_I2C_ADDRESS%2C%20XYZ_DATA_CFG_REG%2C%200x00)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20%2B%2F-2g%20range%20-%26gt%3B%201g%20%3D%2016384%2F4%20%3D%204096%20counts%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2C_WriteRegister(MMA845x_I2C_ADDRESS%2C%20CTRL_REG2%2C%200x02)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20High%20Resolution%20mode%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2C_WriteRegister(MMA845x_I2C_ADDRESS%2C%20%3CSPAN%20style%3D%22color%3A%20%23000000%3B%20font-family%3A%20Consolas%3B%22%3ECTRL_REG%3C%2FSPAN%3E1%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%2C%200x3D)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20ODR%20%3D%201.56Hz%2C%20Reduced%20noise%2C%20Active%20mode%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E3.%20A%20simple%20offset%20calibration%20method%20is%20implemented%20according%20to%20the%20%3CA%20href%3D%22http%3A%2F%2Fwww.freescale.com%2Ffiles%2Fsensors%2Fdoc%2Fapp_note%2FAN4069.pdf%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EAN4069%3C%2FA%3E.%20At%20the%20end%20of%20the%20calibration%20routine%2C%20the%20DRDY%20interrupt%20is%20enabled%20and%20routed%20to%20the%20INT1%20interrupt%20pin%20that%20is%20configured%20to%20be%20a%20push-pull%2C%20active-low%20output.%20%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Evoid%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%3CSTRONG%3ECalibrate%3C%2FSTRONG%3E%20(%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Evoid%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E)%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20unsigned%3C%2FSTRONG%3E%3C%2FSPAN%3E%20%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Echar%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20reg_val%20%3D%200%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%20%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Ewhile%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20(!reg_val)%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Wait%20for%20a%20first%20set%20of%20data%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20reg_val%20%3D%20I2C_ReadRegister(MMA845x_I2C_ADDRESS%2C%20STATUS_REG)%20%26amp%3B%200x08%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2C_ReadMultiRegisters(MMA845x_I2C_ADDRESS%2C%20OUT_X_MSB_REG%2C%206%2C%20AccData)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Read%20data%20output%20registers%200x01-0x06%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Xout_14_bit%20%3D%20((%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Eshort%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E)%20(AccData%5B0%5D%26lt%3B%26lt%3B8%20%7C%20AccData%5B1%5D))%20%26gt%3B%26gt%3B%202%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Compute%2014-bit%20X-axis%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Yout_14_bit%20%3D%20((%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Eshort%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E)%20(AccData%5B2%5D%26lt%3B%26lt%3B8%20%7C%20AccData%5B3%5D))%20%26gt%3B%26gt%3B%202%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Compute%2014-bit%20Y-axis%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Zout_14_bit%20%3D%20((%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Eshort%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E)%20(AccData%5B4%5D%26lt%3B%26lt%3B8%20%7C%20AccData%5B5%5D))%20%26gt%3B%26gt%3B%202%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Compute%2014-bit%20Z-axis%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Xoffset%20%3D%20Xout_14_bit%20%2F%208%20*%20(-1)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Compute%20X-axis%20offset%20correction%20value%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Yoffset%20%3D%20Yout_14_bit%20%2F%208%20*%20(-1)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Compute%20Y-axis%20offset%20correction%20value%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Zoffset%20%3D%20(Zout_14_bit%20-%20SENSITIVITY_2G)%20%2F%208%20*%20(-1)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Compute%20Z-axis%20offset%20correction%20value%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2C_WriteRegister(MMA845x_I2C_ADDRESS%2C%20CTRL_REG1%2C%200x00)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20style%3D%22color%3A%20%23ffffff%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Standby%20mode%20to%20allow%20writing%20to%20the%20offset%20registers%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2C_WriteRegister(MMA845x_I2C_ADDRESS%2C%20OFF_X_REG%2C%20Xoffset)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2C_WriteRegister(MMA845x_I2C_ADDRESS%2C%20OFF_Y_REG%2C%20Yoffset)%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2C_WriteRegister(MMA845x_I2C_ADDRESS%2C%20OFF_Z_REG%2C%20Zoffset)%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2C_WriteRegister(MMA845x_I2C_ADDRESS%2C%20CTRL_REG3%2C%200x00)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Push-pull%2C%20active%20low%20interrupt%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2C_WriteRegister(MMA845x_I2C_ADDRESS%2C%20CTRL_REG4%2C%200x01)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Enable%20DRDY%20interrupt%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2C_WriteRegister(MMA845x_I2C_ADDRESS%2C%20CTRL_REG5%2C%200x01)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20DRDY%20interrupt%20routed%20to%20INT1%20-%20PTA14%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2C_WriteRegister(MMA845x_I2C_ADDRESS%2C%20CTRL_REG1%2C%200x3D)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20ODR%20%3D%201.56Hz%2C%20Reduced%20noise%2C%20Active%20mode%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E4.%20In%20the%20ISR%2C%20only%20the%20interrupt%20flag%20is%20cleared%20and%20the%20DataReady%20variable%20is%20set%20to%20indicate%20the%20arrival%20of%20new%20data.%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Evoid%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%3CSTRONG%3EPORTA_IRQHandler%3C%2FSTRONG%3E()%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20PORTA_PCR14%20%7C%3D%20PORT_PCR_ISF_MASK%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Clear%20the%20interrupt%20flag%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20DataReady%20%3D%201%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E5.%20The%20output%20values%20from%20accelerometer%20registers%200x01%20%E2%80%93%200x06%20are%20first%20converted%20to%20signed%2014-bit%20values%20and%20afterwards%20to%20real%20values%20in%20g%E2%80%99s.%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Eif%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20(DataReady)%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Is%20a%20new%20set%20of%20data%20ready%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%7B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20DataReady%20%3D%200%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2C_ReadMultiRegisters(MMA845x_I2C_ADDRESS%2C%20OUT_X_MSB_REG%2C%206%2C%20AccData)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Read%20data%20output%20registers%200x01-0x06%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Xout_14_bit%20%3D%20((%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Eshort%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E)%20(AccData%5B0%5D%26lt%3B%26lt%3B8%20%7C%20AccData%5B1%5D))%20%26gt%3B%26gt%3B%202%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Compute%2014-bit%20X-axis%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Yout_14_bit%20%3D%20((%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Eshort%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E)%20(AccData%5B2%5D%26lt%3B%26lt%3B8%20%7C%20AccData%5B3%5D))%20%26gt%3B%26gt%3B%202%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Compute%2014-bit%20Y-axis%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Zout_14_bit%20%3D%20((%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Eshort%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E)%20(AccData%5B4%5D%26lt%3B%26lt%3B8%20%7C%20AccData%5B5%5D))%20%26gt%3B%26gt%3B%202%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Compute%2014-bit%20Z-axis%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Xout_g%20%3D%20((%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Efloat%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E)%20Xout_14_bit)%20%2F%20SENSITIVITY_2G%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Compute%20X-axis%20output%20value%20in%20g's%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Yout_g%20%3D%20((%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Efloat%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E)%20Yout_14_bit)%20%2F%20%3CSPAN%20style%3D%22color%3A%20%23000000%3B%20font-family%3A%20Consolas%3B%22%3ESENSITIVITY_2G%3C%2FSPAN%3E%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Compute%20Y-axis%20output%20value%20in%20g's%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Zout_g%20%3D%20((%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Efloat%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E)%20Zout_14_bit)%20%2F%20%3CSPAN%20style%3D%22color%3A%20%23000000%3B%20font-family%3A%20Consolas%3B%22%3ESENSITIVITY_2G%3C%2FSPAN%3E%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Compute%20Z-axis%20output%20value%20in%20g's%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E6.%20The%20calculated%20values%20can%20be%20watched%20in%20the%20%22Variables%22%20window%20on%20the%20top%20right%20of%20the%20Debug%20perspective%20or%20in%20the%20FreeMASTER%20application.%20To%20view%20both%20the%2014-bit%20and%20real%20values%20in%20the%20FreeMASTER%20application%2C%20some%20USBDM%20drivers%20need%20to%20be%20first%20installed%20on%20your%20computer.%20They%20are%20available%20for%20download%20from%20%3CA%20href%3D%22http%3A%2F%2Fsourceforge.net%2Fprojects%2Fusbdm%2Ffiles%2F%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3ESourceForge%3C%2FA%3E.%20Erich%20Styger%20described%20their%20installation%20in%20%3CA%20href%3D%22http%3A%2F%2Fmcuoneclipse.com%2F2013%2F04%2F27%2Fdebug-external-processors-with-usbdm-and-freedom-board%2F%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ethis%3C%2FA%3E%20tutorial.%20In%20addition%20to%20that%2C%20the%20USBDM_OpenSDA%20application%20that%20provides%20both%20debugging%20and%20a%20virtual%20serial%20port%20needs%20to%20be%20loaded%20into%20the%20MK20%20debugger%20chip%20on%20the%20FRDM-KL25Z%20board.%20This%20installation%20follows%20the%20usual%20FRDM-KL25Z%20bootloader%20process%3A%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CUL%3E%3CLI%3EUnplug%20the%20FRDM-KL25Z%20board.%3C%2FLI%3E%3CLI%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3EWhilst%20holding%20the%20SW1%2FRST%20switch%20depressed%20plug%20in%20the%20FRDM-KL25Z%20board.%20The%20green%20LED%20should%20start%20blinking%20at%20a%20rate%20of%20about%201Hz.%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3EOpen%20a%20file%20explorer%20and%20locate%20the%20USB%20drive%20that%20has%20now%20appeared.%20It%20will%20have%20the%20drive%20name%20%22BOOTLOADER%22.%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3EDrag%20the%20file%20%3CA%20href%3D%22http%3A%2F%2Fsourceforge.net%2Fprojects%2Fusbdm%2Ffiles%2FVersion%25204.10.4%2FInstallation%2F%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EUSBDM_OpenSDA.sx%3C%2FA%3E%20to%20the%20USB%20drive%20and%20wait%20a%20short%20while.%20The%20OpenSDA%20firmware%20on%20the%20FRDM-KL25Z%20board%20will%20program%20the%20USBDM%20firmware%20into%20the%20MK20%20debugger%20chip%20on%20the%20board.%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3ERemove%20and%20re-plug%20the%20FRDM-KL25Z%20board.%20The%20board%20will%20now%20appear%20as%20a%20USBDM%20device.%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22FRDM-KL25Z_MMA8451Q_BasicReadUsingInterrupt_HighResolution.JPG.jpg%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22FRDM-KL25Z_MMA8451Q_BasicReadUsingInterrupt_HighResolution.JPG.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111107i1CA47565276E10DB%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22FRDM-KL25Z_MMA8451Q_BasicReadUsingInterrupt_HighResolution.JPG.jpg%22%20alt%3D%22FRDM-KL25Z_MMA8451Q_BasicReadUsingInterrupt_HighResolution.JPG.jpg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22FRDM-KL25Z_MMA8451Q_BasicReadUsingInterrupt_HighResolution_FreeMASTER.JPG.jpg%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22FRDM-KL25Z_MMA8451Q_BasicReadUsingInterrupt_HighResolution_FreeMASTER.JPG.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111108iE3BC30F1F001588A%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22FRDM-KL25Z_MMA8451Q_BasicReadUsingInterrupt_HighResolution_FreeMASTER.JPG.jpg%22%20alt%3D%22FRDM-KL25Z_MMA8451Q_BasicReadUsingInterrupt_HighResolution_FreeMASTER.JPG.jpg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%233d3d3d%3B%20font-family%3A%20'Helvetica%20Neue'%2C%20Helvetica%2C%20Arial%2C%20'Lucida%20Grande'%2C%20sans-serif%3B%20font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%233d3d3d%3B%20font-family%3A%20'Helvetica%20Neue'%2C%20Helvetica%2C%20Arial%2C%20'Lucida%20Grande'%2C%20sans-serif%3B%20font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3EAttached%20you%20can%20find%20the%20complete%20source%20code%20written%20in%20the%20%3C%2FSPAN%3E%3CA%20href%3D%22http%3A%2F%2Fwww.freescale.com%2Fwebapp%2Fsps%2Fsite%2Fprod_summary.jsp%3Fcode%3DCW-MCU10%22%20style%3D%22font-family%3A%20'Helvetica%20Neue'%2C%20Helvetica%2C%20Arial%2C%20'Lucida%20Grande'%2C%20sans-serif%3B%20font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3ECW%20for%20MCU's%20v10.5%3C%2FA%3E%3CSPAN%20style%3D%22color%3A%20%233d3d3d%3B%20font-family%3A%20'Helvetica%20Neue'%2C%20Helvetica%2C%20Arial%2C%20'Lucida%20Grande'%2C%20sans-serif%3B%20font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3E%20as%20well%20as%20the%20FreeMASTER%20project.%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%233d3d3d%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20'Helvetica%20Neue'%2C%20Helvetica%2C%20Arial%2C%20'Lucida%20Grande'%2C%20sans-serif%3B%22%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%233d3d3d%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20'Helvetica%20Neue'%2C%20Helvetica%2C%20Arial%2C%20'Lucida%20Grande'%2C%20sans-serif%3B%22%3ESo%20make%20it%2C%20test%20it%20and%20keep%20in%20touch...%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%233d3d3d%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20'Helvetica%20Neue'%2C%20Helvetica%2C%20Arial%2C%20'Lucida%20Grande'%2C%20sans-serif%3B%22%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%233d3d3d%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20'Helvetica%20Neue'%2C%20Helvetica%2C%20Arial%2C%20'Lucida%20Grande'%2C%20sans-serif%3B%22%3ERegards%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%233d3d3d%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20'Helvetica%20Neue'%2C%20Helvetica%2C%20Arial%2C%20'Lucida%20Grande'%2C%20sans-serif%3B%22%3ETomas%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1127268%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EAccelerometers%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1127275%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20MMA8451Q%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1127275%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Tomas%2C%3CBR%20%2F%3Eis%20there%20any%20chance%20you%20could%20upload%20your%20projects%20again%20as%20they're%20unfortunately%20deleted%20from%20NXP%20sites.%20Working%20on%20MMA8451Q%20with%20KL46Z%20and%20got%20hard%20stuck.%20Can't%20get%20ack%20after%20sending%20my%20address%20to%20I2C.%20I%20would%20really%20appreciate.%20I%20know%20it's%20been%20a%20long%20time%20since%20you%20posted%20this.%26nbsp%3B%3C%2FP%3E%3CH1%20style%3D%22color%3A%20%23646464%3B%20background-color%3A%20%23ffffff%3B%20border%3A%200px%3B%20font-weight%3A%20200%3B%20font-size%3A%202rem%3B%20margin%3A%200px%200px%2030px%3B%20padding%3A%200px%20300px%200px%200px%3B%22%20id%3D%22toc-hId-382542698%22%20id%3D%22toc-hId-1297698967%22%3E%3C%2FH1%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1127274%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20MMA8451Q%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1127274%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Tomas%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EI%C2%B4m%20not%20able%20to%20watch%20the%20variables%20at%20Freemaster%20(I%C2%B4m%20new%20using%20this%20tool)%20and%20I%20don%C2%B4t%20see%20its%20libraries%2C%20functions%2C%20etc.%20from%20your%20souce%20code%2C%20so%20how%20the%20application%20communicate%20with%20Freemaster%20and%20how%20to%20embedded%20in%20a%20new%20baremetal%20project%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1127273%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20MMA8451Q%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1127273%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%20style%3D%22font-family%3A%20arial%2C%20helvetica%2C%20'helvetica%20neue'%2C%20verdana%2C%20sans-serif%3B%20color%3A%20%2351626f%3B%22%3E%3CSPAN%20style%3D%22font-style%3A%20inherit%3B%20font-size%3A%209pt%3B%20font-family%3A%20Arial%2C%20sans-serif%3B%22%3EHi%20Martin%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%20style%3D%22font-family%3A%20arial%2C%20helvetica%2C%20'helvetica%20neue'%2C%20verdana%2C%20sans-serif%3B%20color%3A%20%2351626f%3B%22%3E%3CSPAN%20style%3D%22font-style%3A%20inherit%3B%20font-size%3A%209pt%3B%20font-family%3A%20Arial%2C%20sans-serif%3B%22%3ESince%20the%20FRDM-KL43Z%20board%20does%20not%20have%20both%20the%20communication%20pins%20(PTE24%20%E2%80%93%20I2C0%20SCL%20and%20PTE25%20%E2%80%93%20I2C0%20SDA)%20easily%20accessible%20to%20see%20what%20is%20going%20on%20on%20the%20I%3CSUP%3E2%3C%2FSUP%3EC%20bus%2C%20it%20is%20hard%20to%20say%20where%20the%20problem%20might%20be.%20The%20MKL43Z256%20MCU%20is%20not%20supported%20in%20the%20CW%20for%20MCU%E2%80%99s%20v10.6%2C%20so%20I%20have%20created%20another%20project%20in%20%3CSPAN%20style%3D%22color%3A%20%23017bba%3B%20font-family%3A%20inherit%3B%20font-style%3A%20inherit%3B%22%3E%3CA%20_jive_internal%3D%22true%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fdocs%2FDOC-106619%22%20target%3D%22_blank%22%3EKDS%203.0.0%20using%20KSDK%201.2.0%20and%20Processor%20Expert%3C%2FA%3E.%3C%2FSPAN%3E%20You%20can%20find%20it%20attached%20above%20in%20my%20original%20post.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%20style%3D%22font-family%3A%20arial%2C%20helvetica%2C%20'helvetica%20neue'%2C%20verdana%2C%20sans-serif%3B%20color%3A%20%2351626f%3B%22%3E%3CSPAN%20style%3D%22font-style%3A%20inherit%3B%20font-size%3A%209pt%3B%20font-family%3A%20Arial%2C%20sans-serif%3B%22%3EHope%20it%20helps.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%20style%3D%22font-family%3A%20arial%2C%20helvetica%2C%20'helvetica%20neue'%2C%20verdana%2C%20sans-serif%3B%20color%3A%20%2351626f%3B%22%3E%3CSPAN%20style%3D%22font-style%3A%20inherit%3B%20font-size%3A%209pt%3B%20font-family%3A%20Arial%2C%20sans-serif%3B%22%3ERegards%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22font-family%3A%20arial%2C%20helvetica%2C%20'helvetica%20neue'%2C%20verdana%2C%20sans-serif%3B%20color%3A%20%2351626f%3B%22%3E%3CSPAN%20style%3D%22font-style%3A%20inherit%3B%20font-size%3A%209pt%3B%20font-family%3A%20Arial%2C%20sans-serif%3B%22%3ETomas%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1127272%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20MMA8451Q%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1127272%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Tomas%2C%3C%2FP%3E%3CP%3EI%20tried%20your%20code%20on%20board%20FRDM%20KL43z.%20The%20difference%20between%20it%20and%20KL25z%20is%20that%20the%20pin%20INT1%20is%20the%20pin%20PTC5.%20I%20tested%20initially%20communicate%2C%20therefore%20I%20read%20WHOIAM%20register%20(0x0D)%2C%20but%20returns%20me%20sign%200xFF%2C%20but%20interesting%20is%20that%20once%20function%20return%20correct%20character%200x1A%2C%20but%20after%20restart%20again%20return%200xFF.%20Where%20could%20be%20a%20problem%3F%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1127271%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20MMA8451Q%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1127271%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Tomas%2C%3C%2FP%3E%3CP%3Ethank%20you%20very%20much%20for%20your%20replay%20and%20It%20worked.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3ECharan%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1127270%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20MMA8451Q%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1127270%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Charan%2C%20%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EYou%20might%20find%20useful%20my%20example%20code%20for%20the%20embedded%20transient%20detection%20function%20that%20is%20available%20%3CA%20_jive_internal%3D%22true%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fthread%2F317489%22%20target%3D%22_blank%22%3Ehere%3C%2FA%3E.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EI%20hope%20it%20helps.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3ETomas%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1127269%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20MMA8451Q%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1127269%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EI%20am%20using%20MMA8451Q%20in%20KL25Z%20board%20with%20Code%20Warrior%2010.6%20(processor%20expert).%20I%20have%20configured%20the%20board%20for%20transient%20detection%20but%20i%20was%20not%20able%20to%20generate%20the%20interrupt%20when%20the%20amplitude%20goes%20beyond%20threshold%20level.%20Is%20there%20any%20component%20that%20helps%20to%20write%20the%20ISR%20for%20the%20interrupt%20generated%20on%20PTA14.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3ECharan%3C%2FP%3E%3C%2FLINGO-BODY%3E
No ratings
Version history
Last update:
‎12-06-2013 01:59 AM
Updated by: