<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Re: How to use 2G, 4G, 8G modes in MMA8451Q Accelerometer? in Sensors</title>
    <link>https://community.nxp.com/t5/Sensors/How-to-use-2G-4G-8G-modes-in-MMA8451Q-Accelerometer/m-p/278502#M577</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Amit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;I have just created a simple bare metal example code that illustrates how to achieve the best noise performance on the MMA8451Q. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;If you look at Xout_14_bit, Yout_14_bit or Zout_14_bit variables in the "Variables" window on the top right of the Debug perspective, you will see that they fluctuate by 1 count (1 LSB = ~0.25mg).&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;The code is written in the CW 10.5 for the FRDM-KL25Z board.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Let me know if you found it useful or if you need any further help.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Tomas&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Nov 2013 15:45:32 GMT</pubDate>
    <dc:creator>TomasVaverka</dc:creator>
    <dc:date>2013-11-21T15:45:32Z</dc:date>
    <item>
      <title>How to use 2G, 4G, 8G modes in MMA8451Q Accelerometer?</title>
      <link>https://community.nxp.com/t5/Sensors/How-to-use-2G-4G-8G-modes-in-MMA8451Q-Accelerometer/m-p/278499#M574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I am using code warrior with processor expert, I am using the MMA8451Q Accelerometer library in PE. I printed 100 values of the accelerometer's reading in same position without even touching it, and programatically after 100 readings the mode changed from 2 to 4 and later 8G, but in all 3 sets of values the readings are differing for more than 250 values. but ideally all the 100 values should remain the same. So I want to know how to overcome this problem? I tried changing modes from 2g, 4g, 8g but in all three case the values are differing a lot so I wanted to know how to use these diff. modes ? some required piece of code I am posting below &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#define MMA8451_I2C_ADDR&amp;nbsp;&amp;nbsp; (0x1D) /* I2C slave device address as set in the properties */&lt;/P&gt;&lt;P&gt;#define XYZ_DATA_CFG 0X0E&lt;/P&gt;&lt;P&gt;#define EIGHT_G 0X02&lt;/P&gt;&lt;P&gt;#define FOUR_G 0X01&lt;/P&gt;&lt;P&gt;#define TWO_G 0X00&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;after init function i used&lt;/P&gt;&lt;P&gt;GI2C1_WriteByteAddress8(MMA8451_I2C_ADDR, XYZ_DATA_CFG, EIGHT_G);&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for data acquiring , in for loop I used &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;f_printf(&amp;amp;fp, "%d %d %d \n",MMA1_GetX(),MMA1_GetY(), MMA1_GetZ());&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;after 100 readings I again changed the mode and did the same.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attaching extracted data in different modes.ACC2, ACC4, ACC8 shows accelerometer readings in 2G, 4G, 8G mode.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly look into the matter&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amit Kumar&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-338620" target="_blank"&gt;acc_readings.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2026 21:04:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/How-to-use-2G-4G-8G-modes-in-MMA8451Q-Accelerometer/m-p/278499#M574</guid>
      <dc:creator>Amit_Kumar1</dc:creator>
      <dc:date>2026-02-03T21:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to use 2G, 4G, 8G modes in MMA8451Q Accelerometer?</title>
      <link>https://community.nxp.com/t5/Sensors/How-to-use-2G-4G-8G-modes-in-MMA8451Q-Accelerometer/m-p/278500#M575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Amit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, looking at the extracted data, it seems that you are not changing the dynamic range properly. To change the dynamic range by setting the FS0 and FS1 bits in the XYZ_DATA_CFG register (0x0E), the MMA8451Q must first be put into Standby mode by clearing the ACTIVE bit in the CTRL_REG1 register (0x2A). Then you can write the selected dynamic range in the XYZ_DATA_CFG register and put the part back into the Active mode by setting the ACTIVE bit in the CTRL_REG1 register.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Further, you need to convert the 16-bit raw data to the correct 14-bit signed (2's complement) numbers. &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/quevedo"&gt;quevedo&lt;/A&gt; has already explained it clearly in your &lt;A _jive_internal="true" href="https://community.nxp.com/thread/315696"&gt;another&lt;/A&gt; thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, having the correct data, you will see that the values still fluctuate a little. This fluctuation depends mainly on the selected ODR (DR[2:0] bits) and mode ((S)MODS[1:0] bits). You can minimize it by setting the LNOISE bit and selecting the lowest ODR (1.56Hz) and the High Resolution mode. For more information, please refer to our &lt;A href="http://cache.freescale.com/files/sensors/doc/app_note/AN4075.pdf"&gt;AN4075&lt;/A&gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Nov 2013 18:24:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/How-to-use-2G-4G-8G-modes-in-MMA8451Q-Accelerometer/m-p/278500#M575</guid>
      <dc:creator>TomasVaverka</dc:creator>
      <dc:date>2013-11-20T18:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use 2G, 4G, 8G modes in MMA8451Q Accelerometer?</title>
      <link>https://community.nxp.com/t5/Sensors/How-to-use-2G-4G-8G-modes-in-MMA8451Q-Accelerometer/m-p/278501#M576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Tomas&lt;/P&gt;&lt;P&gt;Following the above mention steps I was able to change the different modes of the accelerometer. but still facing the noise problem. I will go through the document and try to resolve the issue and update it&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Amit Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Nov 2013 10:27:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/How-to-use-2G-4G-8G-modes-in-MMA8451Q-Accelerometer/m-p/278501#M576</guid>
      <dc:creator>Amit_Kumar1</dc:creator>
      <dc:date>2013-11-21T10:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Re: How to use 2G, 4G, 8G modes in MMA8451Q Accelerometer?</title>
      <link>https://community.nxp.com/t5/Sensors/How-to-use-2G-4G-8G-modes-in-MMA8451Q-Accelerometer/m-p/278502#M577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Amit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;I have just created a simple bare metal example code that illustrates how to achieve the best noise performance on the MMA8451Q. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;If you look at Xout_14_bit, Yout_14_bit or Zout_14_bit variables in the "Variables" window on the top right of the Debug perspective, you will see that they fluctuate by 1 count (1 LSB = ~0.25mg).&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;The code is written in the CW 10.5 for the FRDM-KL25Z board.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Let me know if you found it useful or if you need any further help.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Tomas&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Nov 2013 15:45:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/How-to-use-2G-4G-8G-modes-in-MMA8451Q-Accelerometer/m-p/278502#M577</guid>
      <dc:creator>TomasVaverka</dc:creator>
      <dc:date>2013-11-21T15:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: Re: How to use 2G, 4G, 8G modes in MMA8451Q Accelerometer?</title>
      <link>https://community.nxp.com/t5/Sensors/How-to-use-2G-4G-8G-modes-in-MMA8451Q-Accelerometer/m-p/278503#M578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot Tomas&lt;/P&gt;&lt;P&gt;Now the values are very much stable. But Now I am facing another problem, I am printing these values through UART so for Xout_g the floating values are not being printed. i.e I used %f in printf and instead of printing the values it is printing "%f" only. Please help me to resolve this issue.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Amit Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 10:38:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/How-to-use-2G-4G-8G-modes-in-MMA8451Q-Accelerometer/m-p/278503#M578</guid>
      <dc:creator>Amit_Kumar1</dc:creator>
      <dc:date>2013-11-22T10:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use 2G, 4G, 8G modes in MMA8451Q Accelerometer?</title>
      <link>https://community.nxp.com/t5/Sensors/How-to-use-2G-4G-8G-modes-in-MMA8451Q-Accelerometer/m-p/278504#M579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Amit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;I would recommend using the Term component and the SendFloatNum() method. &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/BlackNight"&gt;BlackNight&lt;/A&gt; described this component in &lt;A href="http://mcuoneclipse.com/2013/11/16/tutorial-using-a-terminal-input-and-output-without-printf-and-scanf/"&gt;this tutorial&lt;/A&gt;.&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;I hope it helps.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Tomas&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 13:18:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/How-to-use-2G-4G-8G-modes-in-MMA8451Q-Accelerometer/m-p/278504#M579</guid>
      <dc:creator>TomasVaverka</dc:creator>
      <dc:date>2013-11-22T13:18:43Z</dc:date>
    </item>
  </channel>
</rss>

