FXOS8700CQ - Bare metal example project

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

FXOS8700CQ - Bare metal example project

FXOS8700CQ - Bare metal example project

Hi Everyone,

 

As I am often asked for a simple bare metal example code for the Xtrinsic FXOS8700CQ 6-axis sensor, I would like to share here one of my examples I have created for this part while working with the Freescale FRDM-KL25Z platform and FRDM-FXS-MULTI(-B) sensor expansion board that features many of the Xtrinsic sensors including the FXOS8700CQ. The FreeMASTER tool is used to visualize both the acceleration and magnetic data that are read from the FXOS8700CQ using an interrupt technique through the I2C interface.

 

This example illustrates:

 

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

2. I2C data write and read operations.

3. Initialization of the FXOS8700CQ.

4. Simple accelerometer offset calibration based on the AN4069.

5. Simple magnetic hard-iron offset calibration.

6. Output data reading using an interrupt technique.

7. Conversion of the output values from registers 0x01 – 0x06 and 0x33 – 0x38 to real values in g’s and µT and simple heading angle calculation.

8. Visualization of the calculated values in the FreeMASTER tool.

 

1. As you can see in the FRDM-FXS-MULTI(-B)/FRDM-KL25Z schematics and the image below, I2C signals are routed to the I2C1 module (PTC1 and PTC2 pins) of the KL25Z MCU and the INT1 output is connected to the PTD4 pin (make sure that pins 1-2 of J3 on the sensor expansion board are connected together using a jumper). The INT1 output of the FXOS8700CQ is configured as a push-pull active-low output, so the corresponding PTD4 pin configuration is GPIO with an interrupt on falling edge.

 

12193_12193.jpg

The MCU is, therefore, configured as follows.

 

void MCU_Init(void)

{

     //I2C1 module initialization

     SIM_SCGC4 |= SIM_SCGC4_I2C1_MASK;        // Turn on clock to I2C1 module

     SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;       // Turn on clock to Port C module

     PORTC_PCR1 |= PORT_PCR_MUX(0x2);         // PTC1 pin is I2C1 SCL line

     PORTC_PCR2 |= PORT_PCR_MUX(0x2);         // PTC2 pin is I2C1 SDA line

     I2C1_F  |= I2C_F_ICR(0x14);              // SDA hold time = 2.125us, SCL start hold time = 4.25us, SCL stop hold time = 5.125us

     I2C1_C1 |= I2C_C1_IICEN_MASK;            // Enable I2C0 module

        

     //Configure the PTD4 pin (connected to the INT1 of the FXOS8700CQ) for falling edge interrupts

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

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

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

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

        

         //Enable PORTD interrupt on NVIC

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

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

}

 

2. The 7-bit I2C address of the FXOS8700CQ is 0x1E since both SA0 and SA1 lines are shorted to GND using jumpers J21 and J23 on the sensor board. As shown above, the SCL line is connected to the PTC1 pin and SDA line to the PTC2 pin. The I2C clock frequency is 125 kHz.

 

The screenshot below shows the write operation which writes the value 0x35 to the CTRL_REG1 (0x2A).

 

12189_12189.jpg

 

And here is the single byte read from the WHO_AM_I register 0x0D. As you can see, it returns the correct value 0xC7.

 

12188_12188.jpg

 

Multiple bytes of data can be read from sequential registers after each FXOS8700CQ acknowledgment (AK) is received until a no acknowledge (NAK) occurs from the KL25Z followed by a stop condition (SP) signaling an end of transmission. A burst read of 6 bytes from registers 0x33 to 0x38, that is performed in the calibration routine “FXOS8700CQ_Mag_Calibration()”, is shown below. It also shows when the INT1 pin is automatically cleared.

 

12190_12190.jpg

 

3. At the beginning of the initialization, all registers are reset to their default values by setting the RST bit of the CTRL_REG2 register. Then the FXOS8700CQ is initialized as shown below.

 

void FXOS8700CQ_Init (void)

{

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

 

     Pause(0x631);        // ~1ms delay

 

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, XYZ_DATA_CFG_REG, 0x00);   // +/-2g range with 0.244mg/LSB  

 

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, M_CTRL_REG1, 0x1F);        // Hybrid mode (accelerometer + magnetometer), max OSR

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, M_CTRL_REG2, 0x20);        // M_OUT_X_MSB register 0x33 follows the OUT_Z_LSB register 0x06 (used for burst read)           

 

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

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

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

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, CTRL_REG5, 0x01);          // DRDY interrupt routed to INT1 - PTD4

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, CTRL_REG1, 0x35);          // ODR = 3.125Hz, Reduced noise, Active mode  

}

 

4. A simple accelerometer offset calibration method is implemented according to the AN4069.

 

void FXOS8700CQ_Accel_Calibration (void)

{

     char X_Accel_offset, Y_Accel_offset, Z_Accel_offset;

 

     DataReady = 0;      

         while (!DataReady){}       // Is a first set of data ready?

     DataReady = 0;

 

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, CTRL_REG1, 0x00);          // Standby mode     

 

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

        

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

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

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

        

     X_Accel_offset = Xout_Accel_14_bit / 8 * (-1);         // Compute X-axis offset correction value

     Y_Accel_offset = Yout_Accel_14_bit / 8 * (-1);         // Compute Y-axis offset correction value

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

        

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, OFF_X_REG, X_Accel_offset);            

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, OFF_Y_REG, Y_Accel_offset);     

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, OFF_Z_REG, Z_Accel_offset);     

        

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, CTRL_REG1, 0x35);          // Active mode again

}

 

5. A simple software calibration of magnetic hard-iron offset consists of recording the minimum and maximum magnetometer readings while rotating the board horizontally and vertically and then computing the calibration values from their average. The calibration time is defined by the number of samples taken during calibration (local variable “i” in the while loop) and selected ODR. In my example I use 94 samples at 3.125Hz, so the calibration routine takes 30s.

 

void FXOS8700CQ_Mag_Calibration (void)

{

     short Xout_Mag_16_bit_avg, Yout_Mag_16_bit_avg, Zout_Mag_16_bit_avg;

         short Xout_Mag_16_bit_max, Yout_Mag_16_bit_max, Zout_Mag_16_bit_max;

         short Xout_Mag_16_bit_min, Yout_Mag_16_bit_min, Zout_Mag_16_bit_min;

     char i = 0;

 

     DataReady = 0;

 

         while (i < 94)             // This takes ~30s (94 samples * 1/3.125)

     {

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

        {            

             DataReady = 0;

                                                                                                                                                 

             I2C_ReadMultiRegisters(FXOS8700CQ_I2C_ADDRESS, MOUT_X_MSB_REG, 6, AccelMagData);         // Read data output registers 0x33 - 0x38

                    

             Xout_Mag_16_bit = (short) (AccelMagData[0]<<8 | AccelMagData[1]);        // Compute 16-bit X-axis magnetic output value

             Yout_Mag_16_bit = (short) (AccelMagData[2]<<8 | AccelMagData[3]);        // Compute 16-bit Y-axis magnetic output value

             Zout_Mag_16_bit = (short) (AccelMagData[4]<<8 | AccelMagData[5]);        // Compute 16-bit Z-axis magnetic output value

                   

                       // Assign first sample to maximum and minimum values

                       if (i == 0)

             {

                  Xout_Mag_16_bit_max = Xout_Mag_16_bit;

                  Xout_Mag_16_bit_min = Xout_Mag_16_bit;

                            

                  Yout_Mag_16_bit_max = Yout_Mag_16_bit;

                  Yout_Mag_16_bit_min = Yout_Mag_16_bit;

                            

                  Zout_Mag_16_bit_max = Zout_Mag_16_bit;

                  Zout_Mag_16_bit_min = Zout_Mag_16_bit;

             }

               

                      // Check to see if current sample is the maximum or minimum X-axis value

                      if (Xout_Mag_16_bit > Xout_Mag_16_bit_max)    {Xout_Mag_16_bit_max = Xout_Mag_16_bit;}

                      if (Xout_Mag_16_bit < Xout_Mag_16_bit_min)    {Xout_Mag_16_bit_min = Xout_Mag_16_bit;}

 

                      // Check to see if current sample is the maximum or minimum Y-axis value

                      if (Yout_Mag_16_bit > Yout_Mag_16_bit_max)    {Yout_Mag_16_bit_max = Yout_Mag_16_bit;}

                      if (Yout_Mag_16_bit < Yout_Mag_16_bit_min)    {Yout_Mag_16_bit_min = Yout_Mag_16_bit;}

               

                      // Check to see if current sample is the maximum or minimum Z-axis value

                      if (Zout_Mag_16_bit > Zout_Mag_16_bit_max)    {Zout_Mag_16_bit_max = Zout_Mag_16_bit;}

                      if (Zout_Mag_16_bit < Zout_Mag_16_bit_min)    {Zout_Mag_16_bit_min = Zout_Mag_16_bit;}

               

             i++;

         }     

     }

 

     Xout_Mag_16_bit_avg = (Xout_Mag_16_bit_max + Xout_Mag_16_bit_min) / 2;            // X-axis hard-iron offset

     Yout_Mag_16_bit_avg = (Yout_Mag_16_bit_max + Yout_Mag_16_bit_min) / 2;            // Y-axis hard-iron offset

     Zout_Mag_16_bit_avg = (Zout_Mag_16_bit_max + Zout_Mag_16_bit_min) / 2;            // Z-axis hard-iron offset

 

     // Left-shift by one as magnetometer offset registers are 15-bit only, left justified

     Xout_Mag_16_bit_avg <<= 1;       

     Yout_Mag_16_bit_avg <<= 1;

      Zout_Mag_16_bit_avg <<= 1;

 

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

 

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, MOFF_X_LSB_REG, (char) (Xout_Mag_16_bit_avg & 0xFF));       

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, MOFF_X_MSB_REG, (char) ((Xout_Mag_16_bit_avg >> & 0xFF));      

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, MOFF_Y_LSB_REG, (char) (Yout_Mag_16_bit_avg & 0xFF));

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, MOFF_Y_MSB_REG, (char) ((Yout_Mag_16_bit_avg >> & 0xFF));             

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, MOFF_Z_LSB_REG, (char) (Zout_Mag_16_bit_avg & 0xFF));

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, MOFF_Z_MSB_REG, (char) ((Zout_Mag_16_bit_avg >> & 0xFF));      

 

     I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, CTRL_REG1, 0x35);          // Active mode again      

}

 

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

 

void PORTD_IRQHandler()

{

     PORTD_PCR4 |= PORT_PCR_ISF_MASK;                // Clear the interrupt flag

     DataReady = 1;      

}

 

7. The output values from accelerometer registers 0x01 – 0x06 are first converted to signed 14-bit integer values and afterwards to real values in g’s. Similarly, the output values from magnetometer registers 0x33 – 0x38 are first converted to signed 16-bit integer values and afterwards to real values in microtesla (µT).

 

If the board remains flat, then the compass heading can be simply computed from the arctangent of the ratio of the two horizontal magnetic field components. I have used the atan2 function which returns the result in radians (-π and π), so I multiply it by 180/π to end up with degrees.

 

If you are interested in more complex algorithms for a tilt-compensated e-compass with soft-iron calibration, please refer to our eCompass software.

 

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

{            

     DataReady = 0;

                                                                                                               

     I2C_ReadMultiRegisters(FXOS8700CQ_I2C_ADDRESS, OUT_X_MSB_REG, 12, AccelMagData);         // Read data output registers 0x01-0x06 and 0x33 - 0x38

      

         // 14-bit accelerometer data

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

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

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

               

         // Accelerometer data converted to g's

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

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

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

               

         // 16-bit magnetometer data             

     Xout_Mag_16_bit = (short) (AccelMagData[6]<<8 | AccelMagData[7]);          // Compute 16-bit X-axis magnetic output value

     Yout_Mag_16_bit = (short) (AccelMagData[8]<<8 | AccelMagData[9]);          // Compute 16-bit Y-axis magnetic output value

     Zout_Mag_16_bit = (short) (AccelMagData[10]<<8 | AccelMagData[11]);        // Compute 16-bit Z-axis magnetic output value

                                          

         // Magnetometer data converted to microteslas

     Xout_uT = (float) (Xout_Mag_16_bit) / SENSITIVITY_MAG;        // Compute X-axis output magnetic value in uT

     Yout_uT = (float) (Yout_Mag_16_bit) / SENSITIVITY_MAG;        // Compute Y-axis output magnetic value in uT

     Zout_uT = (float) (Zout_Mag_16_bit) / SENSITIVITY_MAG;        // Compute Z-axis output magnetic value in uT

               

     Heading = atan2 (Yout_uT, Xout_uT) * 180 / PI;         // Compute Yaw angle

}  

 

8. The calculated values can be watched in the "Variables" window on the top right of the Debug perspective or in the FreeMASTER application. To open and run the FreeMASTER project, install the FreeMASTER 1.4 application and FreeMASTER Communication Driver.

 

12191_12191.jpg

 

12216_12216.jpg

 

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

 

If there are any questions regarding this simple application, please feel free to ask below. Your feedback or suggestions are also welcome.

 

Regards,

Tomas

Original Attachment has been moved to: FRDM-KL25Z-FXOS8700CQ-Basic-read-using-I2C-and-interrupt.zip

Original Attachment has been moved to: FreeMASTER---FRDM-KL25Z-FXOS8700CQ-Basic-read-using-I2C-and-interrupt.zip

Labels (2)
Comments

Hi Tomas,

Thanks for posting this project! I want to make a similar project using the FXOS8700CQ that is on the FRDM K64F board and with MQX. Do you know if somebody has done this?

Thanks,
David

Hi David,

Please try contacting Mike Stanley (Mike.Stanley@freescale.com), he and his team have been working on the Xtrinsic sensor fusion library for Kinetis MCUs that is based on MQX Lite RTOS and they recently added support for the FRDM-K64F board.


Regards,

Tomas

Hello,

I am new to these devices. I have been given the task of setting up the FXOS8700CQ on one of our projects. I only intend on using the magnetometer side of the device. I would like to use the interrupt to update a funcation when data is available so it can go and get some data.

If i am using the magnetometer side only, what registers do i need to configure. How do i do a calibration of the magnetometer and general reading of the data from the magnetometer?

Regards,

Luke

Hi David;

Any chance that you got that to work?
I am working on a graduate project and need the same K64f board to work.

Thanks :smileyhappy:

Hi Mustafa,

Have a look at this example code or this post. Hope it helps.

Regards,

Tomas

Hi Tomas,

With the real g’s and µT data, is there an algorithm to calculate the real position?

Thanks,

Tommy

Hi Tommy,

What is the values for SENSITIVITY_MAG=??? & SENSITIVITY_2G=??

Regards,

anil

Hi Thomas,

 

What is the values for SENSITIVITY_MAG=??? & SENSITIVITY_2G=??

 

I am just adding

SENSITIVITY_2G = 0.244 (mg)

SENSITIVITY_MAG = 0.1 (uT)

applying the above values in the code. Is it right? or any other values need to specify.

Regards,

anil

Hi Anil,

This is defined in the FXOS8700CQ.h file (Project_Headers/FXOS8700CQ.h).

//FXOS8700CQ Sensitivity

#define SENSITIVITY_2G 4096
#define SENSITIVITY_4G 2048
#define SENSITIVITY_8G 1024
#define SENSITIVITY_MAG 10

Regards,

Tomas

Hi Thomas,

After converted the Raw values and getting the heading angle shows in between -180 to +180.

 

How to covert from -180 to +180  to 0 to 360 angle.

 

Regards,

Anil

Hi Anil,

I believe it should be pretty simple:

Heading = 180 + atan2 (Yout_uT, Xout_uT) * 180 / PI;

Regards,

Tomas

Hello,

In accelerometer calibration on 2g sensitivity is used this equation: 

Z_Accel_offset = (Zout_Accel_14_bit - SENSITIVITY_2G) / 8 * (-1); 

My question is, and when do I use sensitivity 4g and 8g?
Remains the same equation? The number 8, which divided the first part of the equation, is always this value, either for 2g, 4g or 8g?

In my project, I need change the sensitivity and I want calibrate for this new sensitivity.

Thank for help.

Regards.

Alexandre

Hi Alexandre,

SENSITIVITY_2G corresponds to fs[1:0] = 0b00, SENSITIVITY_4G to fs[1:0] = 0b01 and SENSITIVITY_8G to fs[1:0] = 0b10.

Note that the resolution of OFF_X(YZ) registers is 2mg per LSB, that is why I use the number 8 for 2g. For 4g the number is 4 and for 8g it is 2. For more information please refer to the AN4069.

Regards,

Tomas

Hi Tomas,

   I'm a greenhand to these devises, I'm try to apply the accelerometer FXOS8700CQ in FRDM-K66F board. I'd like to learn to  how to activate the FXOS8700CQ sensor in FRDM-K66F. May I know where can I get some learning materials such as example codes.

Regards,

Yue.

%3CLINGO-SUB%20id%3D%22lingo-sub-1103701%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EFXOS8700CQ%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1103701%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Everyone%2C%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20I%20am%20often%20asked%20for%20a%20simple%20bare%20metal%20example%20code%20for%20the%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fexternal-link.jspa%3Furl%3Dhttp%253A%252F%252Fwww.freescale.com%252Fwebapp%252Fsps%252Fsite%252Fprod_summary.jsp%253Fcode%253DFXOS8700CQ%22%20target%3D%22_blank%22%3EXtrinsic%20FXOS8700CQ%206-axis%20sensor%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%22https%3A%2F%2Fcommunity.nxp.com%2Fexternal-link.jspa%3Furl%3Dhttp%253A%252F%252Fwww.freescale.com%252Fwebapp%252Fsps%252Fsite%252Fprod_summary.jsp%253Fcode%253DFRDM-KL25Z%22%20target%3D%22_blank%22%3EFRDM-KL25Z%20platform%3C%2FA%3E%20and%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fexternal-link.jspa%3Furl%3Dhttp%253A%252F%252Fwww.freescale.com%252Fwebapp%252Fsps%252Fsite%252Fprod_summary.jsp%253Fcode%253DFRDM-FXS-MULTI-B%22%20target%3D%22_blank%22%3EFRDM-FXS-MULTI(-B)%20sensor%20expansion%20board%3C%2FA%3E%20that%20features%20many%20of%20the%20Xtrinsic%20sensors%20including%20the%20FXOS8700CQ.%20The%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fexternal-link.jspa%3Furl%3Dhttp%253A%252F%252Fwww.freescale.com%252Fwebapp%252Fsps%252Fsite%252Fprod_summary.jsp%253Fcode%253DFREEMASTER%22%20target%3D%22_blank%22%3EFreeMASTER%20tool%3C%2FA%3E%20is%20used%20to%20visualize%20both%20the%20acceleration%20and%20magnetic%20data%20that%20are%20read%20from%20the%20FXOS8700CQ%20using%20an%20interrupt%20technique%20through%20the%20I%3CSUP%3E2%3C%2FSUP%3EC%20interface.%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%20background%3A%20white%3B%22%3EThis%20example%20illustrates%3A%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1.%20Initialization%20of%20the%20MKL25Z128%20MCU%20(mainly%20I2C%20and%20PORT%20modules).%3C%2FP%3E%0A%3CP%3E2.%20I%3CSUP%3E2%3C%2FSUP%3EC%20data%20write%20and%20read%20operations.%3C%2FP%3E%0A%3CP%3E3.%20Initialization%20of%20the%20FXOS8700CQ.%3C%2FP%3E%0A%3CP%3E4.%20Simple%20accelerometer%20offset%20calibration%20based%20on%20the%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fexternal-link.jspa%3Furl%3Dhttp%253A%252F%252Fwww.freescale.com%252Ffiles%252Fsensors%252Fdoc%252Fapp_note%252FAN4069.pdf%22%20target%3D%22_blank%22%3EAN4069%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E5.%20Simple%20magnetic%20hard-iron%20offset%20calibration.%3C%2FP%3E%0A%3CP%3E6.%20Output%20data%20reading%20using%20an%20interrupt%20technique.%3C%2FP%3E%0A%3CP%3E7.%20Conversion%20of%20the%20output%20values%20from%20registers%200x01%20%E2%80%93%200x06%20and%200x33%20%E2%80%93%200x38%20to%20real%20values%20in%20g%E2%80%99s%20and%20%C2%B5T%20and%20simple%20heading%20angle%20calculation.%3C%2FP%3E%0A%3CP%3E8.%20Visualization%20of%20the%20calculated%20values%20in%20the%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fexternal-link.jspa%3Furl%3Dhttp%253A%252F%252Fwww.freescale.com%252Fwebapp%252Fsps%252Fsite%252Fprod_summary.jsp%253Fcode%253DFREEMASTER%22%20target%3D%22_blank%22%3EFreeMASTER%20tool%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3E1.%20As%20you%20can%20see%20in%20the%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22line-height%3A%201.5em%3B%20font-size%3A%2010pt%3B%22%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fexternal-link.jspa%3Furl%3Dhttp%253A%252F%252Fcache.freescale.com%252Ffiles%252Fsensors%252Fdoc%252Fsupport_info%252FFRDM-FXS-MULTI-B.pdf%22%20target%3D%22_blank%22%3EFRDM-FXS-MULTI(-B)%3C%2FA%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3E%2F%3C%2FSPAN%3E%3CSPAN%20style%3D%22line-height%3A%201.5em%3B%20font-size%3A%2010pt%3B%22%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fexternal-link.jspa%3Furl%3Dhttp%253A%252F%252Fcache.freescale.com%252Ffiles%252Fsoft_dev_tools%252Fhardware_tools%252Fschematics%252FFRDM-KL25Z_SCH_REV_E.pdf%22%20target%3D%22_blank%22%3EFRDM-KL25Z%3C%2FA%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3E%20schematics%20and%20the%20image%20below%2C%20I2C%20signals%20are%20routed%20to%20the%20I2C1%20module%20(PTC1%20and%20PTC2%20pins)%20of%20the%20KL25Z%20MCU%20and%20the%20INT1%20output%20is%20connected%20to%20the%20PTD4%20pin%20(make%20sure%20that%20pins%201-2%20of%20J3%20on%20the%20sensor%20expansion%20board%20are%20connected%20together%20using%20a%20jumper).%20The%20INT1%20output%20of%20the%20FXOS8700CQ%20is%20configured%20as%20a%20push-pull%20active-low%20output%2C%20so%20the%20corresponding%20PTD4%20pin%20configuration%20is%20GPIO%20with%20an%20interrupt%20on%20falling%20edge.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2212193_12193.jpg%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2212193_12193.jpg%22%20style%3D%22width%3A%20797px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117220iD30D076CC0C7AA65%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%2212193_12193.jpg%22%20alt%3D%2212193_12193.jpg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3EThe%20MCU%20is%2C%20therefore%2C%20configured%20as%20follows.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%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%0A%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%0A%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%20%233f7f5f%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2FI2C1%20module%20initialization%3C%2FSPAN%3E%3C%2FP%3E%0A%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_I2C1_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%20I2C1%20module%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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_PORTC_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%20C%20module%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20PORTC_PCR1%20%7C%3D%20PORT_PCR_MUX(0x2)%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%20PTC1%20pin%20is%20I2C1%20SCL%20line%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20PORTC_PCR2%20%7C%3D%20PORT_PCR_MUX(0x2)%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%20PTC2%20pin%20is%20I2C1%20SDA%20line%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20I2C1_F%26nbsp%3B%20%7C%3D%20I2C_F_ICR(0x14)%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%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20I2C1_C1%20%7C%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%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%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FP%3E%0A%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%20%233f7f5f%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2FConfigure%20the%20PTD4%20pin%20(connected%20to%20the%20INT1%20of%20the%20FXOS8700CQ)%20for%20falling%20edge%20interrupts%3C%2FSPAN%3E%3C%2FP%3E%0A%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_PORTD_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%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20PORTD_PCR4%20%7C%3D%20(0%7CPORT_PCR_ISF_MASK%7C%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%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20PORT_PCR_MUX(0x1)%7C%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%20PTD4%20is%20configured%20as%20GPIO%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20PORT_PCR_IRQC(0xA))%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%20PTD4%20is%20configured%20for%20falling%20edge%20interrupts%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FP%3E%0A%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%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2FEnable%20PORTD%20interrupt%20on%20NVIC%3C%2FSPAN%3E%3C%2FP%3E%0A%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_PORTD%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%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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_PORTD%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%0A%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%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2.%20The%207-bit%20I2C%20address%20of%20the%20FXOS8700CQ%20is%200x1E%20since%20both%20SA0%20and%20SA1%20lines%20are%20shorted%20to%20GND%20using%20jumpers%20J21%20and%20J23%20on%20the%20sensor%20board.%20As%20shown%20above%2C%20the%20SCL%20line%20is%20connected%20to%20the%20PTC1%20pin%20and%20SDA%20line%20to%20the%20PTC2%20pin.%20The%20I2C%20clock%20frequency%20is%20125%20kHz.%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20screenshot%20below%20shows%20the%20write%20operation%20which%20writes%20the%20value%200x35%20to%20the%20CTRL_REG1%20(0x2A).%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2212189_12189.jpg%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2212189_12189.jpg%22%20style%3D%22width%3A%20847px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117221i86D0C92628294F56%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%2212189_12189.jpg%22%20alt%3D%2212189_12189.jpg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnd%20here%20is%20the%20single%20byte%20read%20from%20the%20WHO_AM_I%20register%200x0D.%20As%20you%20can%20see%2C%20it%20returns%20the%20correct%20value%200xC7.%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2212188_12188.jpg%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2212188_12188.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117222i3C47D141E8974197%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%2212188_12188.jpg%22%20alt%3D%2212188_12188.jpg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMultiple%20bytes%20of%20data%20can%20be%20read%20from%20sequential%20registers%20after%20each%20FXOS8700CQ%20acknowledgment%20(AK)%20is%20received%20until%20a%20no%20acknowledge%20(NAK)%20occurs%20from%20the%20KL25Z%20followed%20by%20a%20stop%20condition%20(SP)%20signaling%20an%20end%20of%20transmission.%20A%20burst%20read%20of%206%20bytes%20from%20registers%200x33%20to%200x38%2C%20that%20is%20performed%20in%20the%20calibration%20routine%20%E2%80%9CFXOS8700CQ_Mag_Calibration()%E2%80%9D%2C%20is%20shown%20below.%20It%20also%20shows%20when%20the%20INT1%20pin%20is%20automatically%20cleared.%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2212190_12190.jpg%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2212190_12190.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117223iF34B10A56FA4FD01%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%2212190_12190.jpg%22%20alt%3D%2212190_12190.jpg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3E3.%20At%20the%20beginning%20of%20the%20initialization%2C%20all%20registers%20are%20reset%20to%20their%20default%20values%20by%20setting%20the%20RST%20bit%20of%20the%20CTRL_REG2%20register.%20Then%20the%20FXOS8700CQ%20is%20initialized%20as%20shown%20below.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3EFXOS8700CQ_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%0A%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%0A%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(FXOS8700CQ_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%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%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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%20Pause(0x631)%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%20~1ms%20delay%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20XYZ_DATA_CFG_REG%2C%200x00)%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%20with%200.244mg%2FLSB%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20M_CTRL_REG1%2C%200x1F)%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%20Hybrid%20mode%20(accelerometer%20%2B%20magnetometer)%2C%20max%20OSR%3C%2FSPAN%3E%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20M_CTRL_REG2%2C%200x20)%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%20M_OUT_X_MSB%20register%200x33%20follows%20the%20OUT_Z_LSB%20register%200x06%20(used%20for%20burst%20read)%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%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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(FXOS8700CQ_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%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%0A%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(FXOS8700CQ_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%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%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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(FXOS8700CQ_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%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%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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(FXOS8700CQ_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%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-%20PTD4%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20CTRL_REG1%2C%200x35)%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%203.125Hz%2C%20Reduced%20noise%2C%20Active%20mode%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E4.%20A%20simple%20accelerometer%20offset%20calibration%20method%20is%20implemented%20according%20to%20the%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fexternal-link.jspa%3Furl%3Dhttp%253A%252F%252Fwww.freescale.com%252Ffiles%252Fsensors%252Fdoc%252Fapp_note%252FAN4069.pdf%22%20target%3D%22_blank%22%3EAN4069%3C%2FA%3E.%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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%3EFXOS8700CQ_Accel_Calibration%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%0A%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%0A%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%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%20X_Accel_offset%2C%20Y_Accel_offset%2C%20Z_Accel_offset%3B%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FSPAN%3E%3C%2FP%3E%0A%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%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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(!DataReady)%3C%2FSPAN%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%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%7D%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%20first%20set%20of%20data%20ready%3F%3C%2FSPAN%3E%3C%2FP%3E%0A%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%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20CTRL_REG1%2C%200x00)%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%20Standby%20mode%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20OUT_X_MSB_REG%2C%206%2C%20AccelMagData)%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%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FP%3E%0A%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_Accel_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(AccelMagData%5B0%5D%26lt%3B%26lt%3B8%20%7C%20AccelMagData%5B1%5D))%20%26gt%3B%26gt%3B%202%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%20acceleration%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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_Accel_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(AccelMagData%5B2%5D%26lt%3B%26lt%3B8%20%7C%20AccelMagData%5B3%5D))%20%26gt%3B%26gt%3B%202%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%20acceleration%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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_Accel_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(AccelMagData%5B4%5D%26lt%3B%26lt%3B8%20%7C%20AccelMagData%5B5%5D))%20%26gt%3B%26gt%3B%202%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%20acceleration%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FP%3E%0A%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%20X_Accel_offset%20%3D%20Xout_Accel_14_bit%20%2F%208%20*%20(-1)%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%20offset%20correction%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20Y_Accel_offset%20%3D%20Yout_Accel_14_bit%20%2F%208%20*%20(-1)%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%20offset%20correction%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20Z_Accel_offset%20%3D%20(Zout_Accel_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%0A%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%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20OFF_X_REG%2C%20X_Accel_offset)%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%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20OFF_Y_REG%2C%20Y_Accel_offset)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20OFF_Z_REG%2C%20Z_Accel_offset)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20CTRL_REG1%2C%200x35)%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%20Active%20mode%20again%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E5.%20A%20simple%20software%20calibration%20of%20magnetic%20hard-iron%20offset%20consists%20of%20recording%20the%20minimum%20and%20maximum%20magnetometer%20readings%20while%20rotating%20the%20board%20horizontally%20and%20vertically%20and%20then%20computing%20the%20calibration%20values%20from%20their%20average.%20The%20calibration%20time%20is%20defined%20by%20the%20number%20of%20samples%20taken%20during%20calibration%20(local%20variable%20%E2%80%9Ci%E2%80%9D%20in%20the%20while%20loop)%20and%20selected%20ODR.%20In%20my%20example%20I%20use%2094%20samples%20at%203.125Hz%2C%20so%20the%20calibration%20routine%20takes%2030s.%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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%3EFXOS8700CQ_Mag_Calibration%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%0A%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%0A%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%20%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%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%20Xout_Mag_16_bit_avg%2C%20Yout_Mag_16_bit_avg%2C%20Zout_Mag_16_bit_avg%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%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%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%20Xout_Mag_16_bit_max%2C%20Yout_Mag_16_bit_max%2C%20Zout_Mag_16_bit_max%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%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%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%20Xout_Mag_16_bit_min%2C%20Yout_Mag_16_bit_min%2C%20Zout_Mag_16_bit_min%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20char%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%20i%20%3D%200%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%20margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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(i%20%26lt%3B%2094)%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%20This%20takes%20~30s%20(94%20samples%20*%201%2F3.125)%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%0A%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%20%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%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20%7B%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%0A%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%20DataReady%20%3D%200%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%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%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%3C%2FP%3E%0A%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%20I2C_ReadMultiRegisters(FXOS8700CQ_I2C_ADDRESS%2C%20MOUT_X_MSB_REG%2C%206%2C%20AccelMagData)%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%200x33%20-%200x38%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FP%3E%0A%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%20Xout_Mag_16_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(AccelMagData%5B0%5D%26lt%3B%26lt%3B8%20%7C%20AccelMagData%5B1%5D)%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%2016-bit%20X-axis%20magnetic%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20Yout_Mag_16_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(AccelMagData%5B2%5D%26lt%3B%26lt%3B8%20%7C%20AccelMagData%5B3%5D)%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%2016-bit%20Y-axis%20magnetic%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20Zout_Mag_16_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(AccelMagData%5B4%5D%26lt%3B%26lt%3B8%20%7C%20AccelMagData%5B5%5D)%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%2016-bit%20Z-axis%20magnetic%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FP%3E%0A%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%20%3CSPAN%20style%3D%22color%3A%20%233f7f5f%3B%20font-family%3A%20Consolas%3B%22%3E%2F%2F%20Assign%20first%20sample%20to%20maximum%20and%20minimum%20values%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20%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(i%20%3D%3D%200)%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20%7B%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20Xout_Mag_16_bit_max%20%3D%20Xout_Mag_16_bit%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20Xout_Mag_16_bit_min%20%3D%20Xout_Mag_16_bit%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FP%3E%0A%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%20Yout_Mag_16_bit_max%20%3D%20Yout_Mag_16_bit%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20Yout_Mag_16_bit_min%20%3D%20Yout_Mag_16_bit%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FP%3E%0A%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%20Zout_Mag_16_bit_max%20%3D%20Zout_Mag_16_bit%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20Zout_Mag_16_bit_min%20%3D%20Zout_Mag_16_bit%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20%7D%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FP%3E%0A%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%20%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Check%20to%20see%20if%20current%20sample%20is%20the%20maximum%20or%20minimum%20X-axis%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20%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(Xout_Mag_16_bit%20%26gt%3B%20Xout_Mag_16_bit_max)%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7BXout_Mag_16_bit_max%20%3D%20Xout_Mag_16_bit%3B%7D%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20%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(Xout_Mag_16_bit%20%26lt%3B%20Xout_Mag_16_bit_min)%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7BXout_Mag_16_bit_min%20%3D%20Xout_Mag_16_bit%3B%7D%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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%20%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Check%20to%20see%20if%20current%20sample%20is%20the%20maximum%20or%20minimum%20Y-axis%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20%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(Yout_Mag_16_bit%20%26gt%3B%20Yout_Mag_16_bit_max)%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7BYout_Mag_16_bit_max%20%3D%20Yout_Mag_16_bit%3B%7D%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20%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(Yout_Mag_16_bit%20%26lt%3B%20Yout_Mag_16_bit_min)%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7BYout_Mag_16_bit_min%20%3D%20Yout_Mag_16_bit%3B%7D%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FP%3E%0A%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%20%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Check%20to%20see%20if%20current%20sample%20is%20the%20maximum%20or%20minimum%20Z-axis%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20%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(Zout_Mag_16_bit%20%26gt%3B%20Zout_Mag_16_bit_max)%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7BZout_Mag_16_bit_max%20%3D%20Zout_Mag_16_bit%3B%7D%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20%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(Zout_Mag_16_bit%20%26lt%3B%20Zout_Mag_16_bit_min)%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7BZout_Mag_16_bit_min%20%3D%20Zout_Mag_16_bit%3B%7D%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FP%3E%0A%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%20i%2B%2B%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20%7D%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20black%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%7D%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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_Mag_16_bit_avg%20%3D%20(Xout_Mag_16_bit_max%20%2B%20Xout_Mag_16_bit_min)%20%2F%202%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%20X-axis%20hard-iron%20offset%3C%2FSPAN%3E%3C%2FP%3E%0A%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_Mag_16_bit_avg%20%3D%20(Yout_Mag_16_bit_max%20%2B%20Yout_Mag_16_bit_min)%20%2F%202%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%20Y-axis%20hard-iron%20offset%3C%2FSPAN%3E%3C%2FP%3E%0A%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_Mag_16_bit_avg%20%3D%20(Zout_Mag_16_bit_max%20%2B%20Zout_Mag_16_bit_min)%20%2F%202%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%20Z-axis%20hard-iron%20offset%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20%233f7f5f%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%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%20%233f7f5f%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20Left-shift%20by%20one%20as%20magnetometer%20offset%20registers%20are%2015-bit%20only%2C%20left%20justified%3C%2FSPAN%3E%3C%2FP%3E%0A%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_Mag_16_bit_avg%20%26lt%3B%26lt%3B%3D%201%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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_Mag_16_bit_avg%20%26lt%3B%26lt%3B%3D%201%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%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%20Zout_Mag_16_bit_avg%20%26lt%3B%26lt%3B%3D%201%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20CTRL_REG1%2C%200x00)%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%20Standby%20mode%20to%20allow%20writing%20to%20the%20offset%20registers%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20MOFF_X_LSB_REG%2C%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%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)%20(Xout_Mag_16_bit_avg%20%26amp%3B%200xFF))%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20MOFF_X_MSB_REG%2C%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%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)%20((Xout_Mag_16_bit_avg%20%26gt%3B%26gt%3B%20%3CLI-EMOJI%20id%3D%22lia_smiling-face-with-sunglasses%22%20title%3D%22%3Asmiling_face_with_sunglasses%3A%22%3E%3C%2FLI-EMOJI%3E%20%26amp%3B%200xFF))%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20MOFF_Y_LSB_REG%2C%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%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)%20(Yout_Mag_16_bit_avg%20%26amp%3B%200xFF))%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20MOFF_Y_MSB_REG%2C%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%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)%20((Yout_Mag_16_bit_avg%20%26gt%3B%26gt%3B%20%3CLI-EMOJI%20id%3D%22lia_smiling-face-with-sunglasses%22%20title%3D%22%3Asmiling_face_with_sunglasses%3A%22%3E%3C%2FLI-EMOJI%3E%20%26amp%3B%200xFF))%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%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20MOFF_Z_LSB_REG%2C%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%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)%20(Zout_Mag_16_bit_avg%20%26amp%3B%200xFF))%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20MOFF_Z_MSB_REG%2C%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%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)%20((Zout_Mag_16_bit_avg%20%26gt%3B%26gt%3B%20%3CLI-EMOJI%20id%3D%22lia_smiling-face-with-sunglasses%22%20title%3D%22%3Asmiling_face_with_sunglasses%3A%22%3E%3C%2FLI-EMOJI%3E%20%26amp%3B%200xFF))%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20CTRL_REG1%2C%200x35)%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%20Active%20mode%20again%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Consolas%3B%20font-size%3A%2010pt%3B%20line-height%3A%201.5em%3B%22%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E6.%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%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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%3EPORTD_IRQHandler%3C%2FSTRONG%3E()%3C%2FSPAN%3E%3C%2FP%3E%0A%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%0A%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%20PORTD_PCR4%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%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%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E7.%20The%20output%20values%20from%20accelerometer%20registers%200x01%20%E2%80%93%200x06%20are%20first%20converted%20to%20signed%2014-bit%20integer%20values%20and%20afterwards%20to%20real%20values%20in%20g%E2%80%99s.%20Similarly%2C%20the%20output%20values%20from%20magnetometer%20registers%200x33%20%E2%80%93%200x38%20are%20first%20converted%20to%20signed%2016-bit%20integer%20values%20and%20afterwards%20to%20real%20values%20in%20microtesla%20(%C2%B5T).%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20the%20board%20remains%20flat%2C%20then%20the%20compass%20heading%20can%20be%20simply%20computed%20from%20the%20arctangent%20of%20the%20ratio%20of%20the%20two%20horizontal%20magnetic%20field%20components.%20I%20have%20used%20the%20atan2%20function%20which%20returns%20the%20result%20in%20radians%20(-%CF%80%20and%20%CF%80)%2C%20so%20I%20multiply%20it%20by%20180%2F%CF%80%20to%20end%20up%20with%20degrees.%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20are%20interested%20in%20more%20complex%20algorithms%20for%20a%20tilt-compensated%20e-compass%20with%20soft-iron%20calibration%2C%20please%20refer%20to%20our%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fexternal-link.jspa%3Furl%3Dhttp%253A%252F%252Fwww.freescale.com%252Fwebapp%252Fsps%252Fsite%252Fprod_summary.jsp%253Fcode%253DE-Compass%22%20target%3D%22_blank%22%3EeCompass%20software%3C%2FA%3E.%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%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%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%0A%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%3C%2FP%3E%0A%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(FXOS8700CQ_I2C_ADDRESS%2C%20OUT_X_MSB_REG%2C%2012%2C%20AccelMagData)%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%20and%200x33%20-%200x38%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%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%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%2014-bit%20accelerometer%20data%3C%2FSPAN%3E%3C%2FP%3E%0A%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_Accel_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(AccelMagData%5B0%5D%26lt%3B%26lt%3B8%20%7C%20AccelMagData%5B1%5D))%20%26gt%3B%26gt%3B%202%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%20acceleration%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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_Accel_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(AccelMagData%5B2%5D%26lt%3B%26lt%3B8%20%7C%20AccelMagData%5B3%5D))%20%26gt%3B%26gt%3B%202%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%20acceleration%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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_Accel_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(AccelMagData%5B4%5D%26lt%3B%26lt%3B8%20%7C%20AccelMagData%5B5%5D))%20%26gt%3B%26gt%3B%202%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%20acceleration%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FP%3E%0A%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%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Accelerometer%20data%20converted%20to%20g's%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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_Accel_14_bit)%20%2F%20SENSITIVITY_2G%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%0A%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_Accel_14_bit)%20%2F%20SENSITIVITY_2G%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%0A%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_Accel_14_bit)%20%2F%20SENSITIVITY_2G%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%20%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FP%3E%0A%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%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%2016-bit%20magnetometer%20data%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%0A%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_Mag_16_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(AccelMagData%5B6%5D%26lt%3B%26lt%3B8%20%7C%20AccelMagData%5B7%5D)%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%2016-bit%20X-axis%20magnetic%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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_Mag_16_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(AccelMagData%5B8%5D%26lt%3B%26lt%3B8%20%7C%20AccelMagData%5B9%5D)%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%2016-bit%20Y-axis%20magnetic%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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_Mag_16_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(AccelMagData%5B10%5D%26lt%3B%26lt%3B8%20%7C%20AccelMagData%5B11%5D)%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%2016-bit%20Z-axis%20magnetic%20output%20value%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FP%3E%0A%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%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20Magnetometer%20data%20converted%20to%20microteslas%3C%2FSPAN%3E%3C%2FP%3E%0A%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_uT%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)%20(Xout_Mag_16_bit)%20%2F%20SENSITIVITY_MAG%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%20magnetic%20value%20in%20uT%3C%2FSPAN%3E%3C%2FP%3E%0A%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_uT%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)%20(Yout_Mag_16_bit)%20%2F%20SENSITIVITY_MAG%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%20magnetic%20value%20in%20uT%3C%2FSPAN%3E%3C%2FP%3E%0A%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_uT%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)%20(Zout_Mag_16_bit)%20%2F%20SENSITIVITY_MAG%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%20magnetic%20value%20in%20uT%3C%2FSPAN%3E%3C%2FP%3E%0A%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%3C%2FP%3E%0A%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%20Heading%20%3D%20atan2%20(Yout_uT%2C%20Xout_uT)%20*%20180%20%2F%20PI%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%20Yaw%20angle%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%7D%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Arial%2C%20sans-serif%3B%20font-size%3A%209pt%3B%20line-height%3A%201.5em%3B%20background-color%3A%20white%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E8.%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%20open%20and%20run%20the%20FreeMASTER%20project%2C%20install%20the%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fexternal-link.jspa%3Furl%3Dhttp%253A%252F%252Fwww.freescale.com%252Fwebapp%252Fsps%252Fsite%252Fprod_summary.jsp%253Fcode%253DFREEMASTER%2526fpsp%253D1%2526tab%253DDesign_Tools_Tab%22%20target%3D%22_blank%22%3EFreeMASTER%201.4%20application%3C%2FA%3E%20and%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fexternal-link.jspa%3Furl%3Dhttp%253A%252F%252Fwww.freescale.com%252Fwebapp%252Fsps%252Fsite%252Fprod_summary.jsp%253Fcode%253DFREEMASTER%2526fpsp%253D1%2526tab%253DDesign_Tools_Tab%22%20target%3D%22_blank%22%3EFreeMASTER%20Communication%20Driver%3C%2FA%3E.%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2212191_12191.jpg%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2212191_12191.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117224i68EF8044FD2EE967%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%2212191_12191.jpg%22%20alt%3D%2212191_12191.jpg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2212216_12216.jpg%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2212216_12216.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117225i09397BAD896E140C%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%2212216_12216.jpg%22%20alt%3D%2212216_12216.jpg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22font-family%3A%20'Helvetica%20Neue'%2C%20Helvetica%2C%20Arial%2C%20'Lucida%20Grande'%2C%20sans-serif%3B%20color%3A%20%233d3d3d%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20inherit%3B%20font-style%3A%20inherit%3B%20font-size%3A%2010pt%3B%22%3EAttached%20you%20can%20find%20the%20complete%20source%20code%20written%20in%20the%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-weight%3A%20inherit%3B%20font-style%3A%20inherit%3B%20color%3A%20%236a737b%3B%22%3E%3CA%20class%3D%22jive-link-external-small%22%20style%3D%22font-weight%3A%20inherit%3B%20font-style%3A%20inherit%3B%20font-family%3A%20inherit%3B%20color%3A%20%236a737b%3B%22%20href%3D%22http%3A%2F%2Fwww.freescale.com%2Fwebapp%2Fsps%2Fsite%2Fprod_summary.jsp%3Fcode%3DCW-MCU10%22%20data-content-finding%3D%22Community%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3ECW%20for%20MCU's%20v10.5%3C%2FA%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-weight%3A%20inherit%3B%20font-style%3A%20inherit%3B%20font-size%3A%2010pt%3B%22%3E%20including%20the%20FreeMASTER%20project.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22font-family%3A%20'Helvetica%20Neue'%2C%20Helvetica%2C%20Arial%2C%20'Lucida%20Grande'%2C%20sans-serif%3B%20color%3A%20%233d3d3d%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20inherit%3B%20font-style%3A%20inherit%3B%22%3EIf%20there%20are%20any%20questions%20regarding%20this%20simple%20application%2C%20please%20feel%20free%20to%20ask%20below.%20Your%20feedback%20or%20suggestions%20are%20also%20welcome.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22font-family%3A%20'Helvetica%20Neue'%2C%20Helvetica%2C%20Arial%2C%20'Lucida%20Grande'%2C%20sans-serif%3B%20color%3A%20%233d3d3d%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20inherit%3B%20font-style%3A%20inherit%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22font-family%3A%20'Helvetica%20Neue'%2C%20Helvetica%2C%20Arial%2C%20'Lucida%20Grande'%2C%20sans-serif%3B%20color%3A%20%233d3d3d%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20inherit%3B%20font-style%3A%20inherit%3B%22%3ERegards%2C%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22font-family%3A%20'Helvetica%20Neue'%2C%20Helvetica%2C%20Arial%2C%20'Lucida%20Grande'%2C%20sans-serif%3B%20color%3A%20%233d3d3d%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20inherit%3B%20font-style%3A%20inherit%3B%22%3ETomas%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EOriginal%20Attachment%20has%20been%20moved%20to%3A%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fdocs%2FDOC-339248%22%20target%3D%22_blank%22%3EFRDM-KL25Z-FXOS8700CQ-Basic-read-using-I2C-and-interrupt.zip%3C%2FA%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EOriginal%20Attachment%20has%20been%20moved%20to%3A%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fdocs%2FDOC-339248%22%20target%3D%22_blank%22%3EFreeMASTER---FRDM-KL25Z-FXOS8700CQ-Basic-read-using-I2C-and-interrupt.zip%3C%2FA%3E%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1103701%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EAccelerometers%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMagnetic%20Sensors%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1103716%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20FXOS8700CQ%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1103716%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Tomas%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3BI'm%20a%20greenhand%20to%20these%20devises%2C%20I'm%20try%20to%20apply%20the%20accelerometer%26nbsp%3B%3CSPAN%20style%3D%22color%3A%20%2351626f%3B%20background-color%3A%20%23ffffff%3B%22%3EFXOS8700CQ%20in%20FRDM-K66F%20board.%20I'd%20like%20to%20learn%20to%26nbsp%3B%20how%20to%20activate%20the%26nbsp%3B%3CSPAN%3EFXOS8700CQ%20sensor%20in%20FRDM-K66F.%20May%20I%20know%20where%20can%20I%20get%20some%20learning%20materials%20such%20as%20example%20codes.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%2351626f%3B%20background-color%3A%20%23ffffff%3B%22%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%2351626f%3B%20background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%3ERegards%2C%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%2351626f%3B%20background-color%3A%20%23ffffff%3B%22%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%2351626f%3B%20background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%3EYue.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1103715%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20FXOS8700CQ%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1103715%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Alexandre%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ESENSITIVITY_2G%20corresponds%20to%20fs%5B1%3A0%5D%20%3D%200b00%2C%20SENSITIVITY_4G%20to%20fs%5B1%3A0%5D%20%3D%200b01%20and%20SENSITIVITY_8G%20to%20fs%5B1%3A0%5D%20%3D%200b10.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ENote%20that%20the%20resolution%20of%20OFF_X(YZ)%20registers%20is%202mg%20per%20LSB%2C%20that%20is%20why%20I%20use%20the%20number%208%20for%202g.%20For%204g%20the%20number%20is%204%20and%20for%208g%20it%20is%202.%20For%20more%20information%20please%20refer%20to%20the%20AN4069.%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-1103714%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20FXOS8700CQ%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1103714%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EIn%20accelerometer%20calibration%20on%202g%20sensitivity%20is%20used%20this%20equation%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%20background-color%3A%20%23ffffff%3B%20font-size%3A%2013.3333px%3B%22%3EZ_Accel_offset%20%3D%20(Zout_Accel_14_bit%20-%20SENSITIVITY_2G)%20%2F%208%20*%20(-1)%3B%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EMy%20question%20is%2C%20and%20when%20do%20I%20use%20sensitivity%204g%20and%208g%3F%3CBR%20%2F%3ERemains%20the%20same%20equation%3F%20The%20number%208%2C%20which%20divided%20the%20first%20part%20of%20the%20equation%2C%20is%20always%20this%20value%2C%20either%20for%202g%2C%204g%20or%208g%3F%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EIn%20my%20project%2C%20I%20need%20change%20the%20sensitivity%20and%20I%20want%26nbsp%3Bcalibrate%20for%20this%20new%20sensitivity.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EThank%20for%20help.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ERegards.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EAlexandre%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1103713%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20FXOS8700CQ%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1103713%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Anil%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EI%20believe%20it%20should%20be%20pretty%20simple%3A%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3EHeading%20%3D%20180%20%2B%20atan2%20(Yout_uT%2C%20Xout_uT)%20*%20180%20%2F%20PI%3B%3C%2FSPAN%3E%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-1103712%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20FXOS8700CQ%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1103712%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Thomas%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EAfter%20converted%20the%20Raw%20values%20and%20getting%20the%20heading%20angle%20shows%20in%20between%20-180%20to%20%2B180.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EHow%20to%20covert%20from%20-180%20to%20%2B180%20%26nbsp%3Bto%200%20to%20360%20angle.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3EAnil%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1103711%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20FXOS8700CQ%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1103711%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Anil%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EThis%20is%20defined%20in%20the%20FXOS8700CQ.h%20file%20(Project_Headers%2FFXOS8700CQ.h).%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%2F%2FFXOS8700CQ%20Sensitivity%3C%2FP%3E%3CP%3E%23define%20SENSITIVITY_2G%204096%3CBR%20%2F%3E%23define%20SENSITIVITY_4G%202048%3CBR%20%2F%3E%23define%20SENSITIVITY_8G%201024%3CBR%20%2F%3E%23define%20SENSITIVITY_MAG%2010%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-1103710%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20FXOS8700CQ%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1103710%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CDIV%20class%3D%22%22%3E%3CP%3EHi%20Thomas%2C%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20is%20the%20values%20for%20SENSITIVITY_MAG%3D%3F%3F%3F%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%26amp%3B%20SENSITIVITY_2G%3D%3F%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3EI%20am%20just%20adding%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3ESENSITIVITY_2G%20%3D%20%3C%2FSPAN%3E0.244%20(mg)%3C%2FP%3E%3CP%3ESENSITIVITY_MAG%20%3D%200.1%20(uT)%3C%2FP%3E%3CP%3Eapplying%20the%20above%20values%20in%20the%20code.%20Is%20it%20right%3F%20or%20any%20other%20values%20need%20to%20specify.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3Eanil%3C%2FP%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1103709%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20FXOS8700CQ%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1103709%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Tommy%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EWhat%20is%20the%20values%20for%20SENSITIVITY_MAG%3D%3F%3F%3F%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%26amp%3B%20SENSITIVITY_2G%3D%3F%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3Eanil%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1103708%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20FXOS8700CQ%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1103708%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Tomas%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EWith%20the%20real%26nbsp%3B%3CSPAN%20style%3D%22color%3A%20%2351626f%3B%20background-color%3A%20%23ffffff%3B%22%3Eg%E2%80%99s%20and%20%C2%B5T%20data%2C%20is%20there%20an%20algorithm%20to%20calculate%20the%20real%20position%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%2351626f%3B%20background-color%3A%20%23ffffff%3B%22%3EThanks%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%2351626f%3B%20background-color%3A%20%23ffffff%3B%22%3ETommy%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1103707%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20FXOS8700CQ%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1103707%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Mustafa%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EHave%20a%20look%20at%20%3CA%20_jive_internal%3D%22true%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fdocs%2FDOC-104587%22%20target%3D%22_blank%22%3Ethis%3C%2FA%3E%20example%20code%20or%20%3CA%20href%3D%22http%3A%2F%2Fblogs.freescale.com%2Fsensors%2F2015%2F04%2Fcreating-a-data-logger-embedded-application-using-the-intelligent-sensing-framework-isf-2-1%2F%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ethis%3C%2FA%3E%20post.%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-1103706%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20FXOS8700CQ%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1103706%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20David%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EAny%20chance%20that%20you%20got%20that%20to%20work%3F%3CBR%20%2F%3EI%20am%20working%20on%20a%20graduate%20project%20and%20need%20the%20same%20K64f%20board%20to%20work.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EThanks%20%3CIMG%20id%3D%22smileyhappy%22%20class%3D%22emoticon%20emoticon-smileyhappy%22%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fi%2Fsmilies%2F16x16_smiley-happy.png%22%20alt%3D%22Smiley%20Happy%22%20title%3D%22Smiley%20Happy%22%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1103705%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20FXOS8700CQ%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1103705%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Luke%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ESee%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fmessage%2F520588%22%20target%3D%22_blank%22%3ERe%3A%20Setting%20up%20the%20FXOS8700CQ%20Magnetometer%20side%20only%3F%3C%2FA%3E%20%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-1103704%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20FXOS8700CQ%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1103704%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EI%20am%20new%20to%20these%20devices.%20I%20have%20been%20given%20the%20task%20of%20setting%20up%20the%20FXOS8700CQ%20on%20one%20of%20our%20projects.%20I%20only%20intend%20on%20using%20the%20magnetometer%20side%20of%20the%20device.%20I%20would%20like%20to%20use%20the%20interrupt%20to%20update%20a%20funcation%20when%20data%20is%20available%20so%20it%20can%20go%20and%20get%20some%20data.%20%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EIf%20i%20am%20using%20the%20magnetometer%20side%20only%2C%20what%20registers%20do%20i%20need%20to%20configure.%20How%20do%20i%20do%20a%20calibration%20of%20the%20magnetometer%20and%20general%20reading%20of%20the%20data%20from%20the%20magnetometer%3F%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3ELuke%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1103703%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20FXOS8700CQ%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1103703%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20David%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%209.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%20color%3A%20black%3B%20background%3A%20white%3B%22%3E%3CSPAN%3EPlease%20try%20contacting%20Mike%20Stanley%20(%3C%2FSPAN%3E%3CA%20class%3D%22jive-link-email-small%22%20href%3D%22mailto%3AMike.Stanley%40freescale.com%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EMike.Stanley%40freescale.com%3C%2FA%3E%3CSPAN%3E)%2C%20he%20and%20his%20team%20have%20been%20working%20on%20the%20%3C%2FSPAN%3E%3CA%20_jive_internal%3D%22true%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fcommunity%2Fthe-embedded-beat%2Fblog%2F2014%2F05%2F30%2Ffreescalecomsensorfusion%22%20target%3D%22_blank%22%3EXtrinsic%20sensor%20fusion%20library%20for%20Kinetis%20MCUs%3C%2FA%3E%20that%20is%20based%20on%20MQX%20Lite%20RTOS%20and%20they%20recently%20added%20support%20for%20the%20FRDM-K64F%20board.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%209.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%20color%3A%20black%3B%20background%3A%20white%3B%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%209.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%20color%3A%20black%3B%20background%3A%20white%3B%22%3ERegards%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%209.0pt%3B%20font-family%3A%20'Arial'%2C'sans-serif'%3B%20color%3A%20black%3B%20background%3A%20white%3B%22%3ETomas%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1103702%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20FXOS8700CQ%20-%20Bare%20metal%20example%20project%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1103702%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Tomas%2C%3C%2FP%3E%3CP%3EThanks%20for%20posting%20this%20project!%20I%20want%20to%20make%20a%20similar%20project%20using%20the%20FXOS8700CQ%20that%20is%20on%20the%20FRDM%20K64F%20board%20and%20with%20MQX.%20Do%20you%20know%20if%20somebody%20has%20done%20this%3F%3C%2FP%3E%3CP%3EThanks%2C%3CBR%20%2F%3EDavid%3C%2FP%3E%3C%2FLINGO-BODY%3E
No ratings
Version history
Last update:
‎09-11-2020 10:23 AM
Updated by: