<?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: MMA7660FC Programming in Sensors</title>
    <link>https://community.nxp.com/t5/Sensors/MMA7660FC-Programming/m-p/215881#M174</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh. Cool. I was hoping for a "No, Dummy, you do it this way," type reply. Somehow I had in mind you had to write the address you wanted to read. (Too many things to learn at one time before I get a response.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Jan 2013 17:00:15 GMT</pubDate>
    <dc:creator>torby</dc:creator>
    <dc:date>2013-01-03T17:00:15Z</dc:date>
    <item>
      <title>MMA7660FC Programming</title>
      <link>https://community.nxp.com/t5/Sensors/MMA7660FC-Programming/m-p/215879#M172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Must have something wrong here as any register I read from my MMA7660FC contains 255.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using AVR processors, 'cause that's what I know, and Peter Fluery's vaunted I2c library. This is my first try at using I2C. It seems pretty nice, if I can make it work&lt;SPAN aria-label="Blush" class="emoticon-inline emoticon_blush" style="height:16px;width:16px;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I try to start with the wrong slave address, I get no response. If I use the correct slave address, 0x4C &amp;lt;&amp;lt; 1, I do get a response, so I suspect my test board is working. &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, in setting up my MMA7660FC, I first:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WriteMMA(MMA_SR,7); // 1 sample per second, no filter.&lt;/P&gt;&lt;P&gt;WriteMMA(MMA_INTSU,1); // Back/Front interrupt (which isn't hooked up)&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My writeMMA method is:&lt;/P&gt;&lt;P&gt;void WriteMMA(uint8_t R, uint8_t V) // Write v into register R&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;i2c_start_wait(MMA+I2C_WRITE); // set device address and write mode&lt;/P&gt;&lt;P&gt;i2c_write(R); // Register to write&lt;/P&gt;&lt;P&gt;i2c_write(V); // Value to write&lt;/P&gt;&lt;P&gt;i2c_stop();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, I loop, reading the tilt register and displaying it whenever it changes.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;while(1)&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;uint8_t X = ReadMMA(MMA_TILT) ; // Read the x register&lt;/P&gt;&lt;P&gt;if (oX != X)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;oX = X;&lt;/P&gt;&lt;P&gt;j += 1;&lt;/P&gt;&lt;P&gt;LCDclear();&lt;/P&gt;&lt;P&gt;ShowByte(j);&lt;/P&gt;&lt;P&gt;LCDxy(0,1);&lt;/P&gt;&lt;P&gt;ShowByte(X);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Do you have [CODE] tags here?)&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And, the ReadMMA method always gets me 255.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;I've attached the source of the actual program. &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know the program is lame, but I generally don't write a complicated program doing something I don't know anything about until I've made something simple that I don't know anything about work.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have I missed something in the setup?&lt;/P&gt;&lt;P&gt;Perhaps I'm misusing ack and nak while reading?&lt;/P&gt;&lt;P&gt;Perhaps my program is correct and my little test board is wonky?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(This is the second time I've tried soldering one of these "QFN" type things without any pins. I don't want to talk about the first try &lt;SPAN aria-label="Grin" class="emoticon-inline emoticon_grin" style="height:16px;width:16px;"&gt;&lt;/SPAN&gt; ) &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-338753" target="_blank"&gt;Torby.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2026 21:09:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/MMA7660FC-Programming/m-p/215879#M172</guid>
      <dc:creator>torby</dc:creator>
      <dc:date>2026-02-03T21:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: MMA7660FC Programming</title>
      <link>https://community.nxp.com/t5/Sensors/MMA7660FC-Programming/m-p/215880#M173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="CS" style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Looking at your source code, I do not think that your ReadMMA function is correct. You are sending 0x99 ((&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;0x4C &amp;lt;&amp;lt; 1) | 0x01) at first, while a read from the MMA7660FC actually starts off by writing to it.&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;As shown in Figure 3 of the MMA7660FC data sheet, the message format for reading from the accelerometer is as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="CS" style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;1. Send a start sequence&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="CS" style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;2. Send 0x4C with the R/W bit low (0x98)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="CS" style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;3. Send internal address of the register you want to read from&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="CS" style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;4. Send a start sequence again (repeated start)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="CS" style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;5. Send 0x4C with the R/W bit high (0x99)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="CS" style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;6. Read a data byte from MMA7660FC&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="CS" style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;7. [Optionally, read any further data bytes]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="CS" style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;8. Send NAK and a stop sequence&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="CS" 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 lang="CS" style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="CS" style="font-size: 10.0pt; font-family: 'Arial','sans-serif';"&gt;Tomas&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2013 14:52:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/MMA7660FC-Programming/m-p/215880#M173</guid>
      <dc:creator>TomasVaverka</dc:creator>
      <dc:date>2013-01-03T14:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: MMA7660FC Programming</title>
      <link>https://community.nxp.com/t5/Sensors/MMA7660FC-Programming/m-p/215881#M174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh. Cool. I was hoping for a "No, Dummy, you do it this way," type reply. Somehow I had in mind you had to write the address you wanted to read. (Too many things to learn at one time before I get a response.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2013 17:00:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/MMA7660FC-Programming/m-p/215881#M174</guid>
      <dc:creator>torby</dc:creator>
      <dc:date>2013-01-03T17:00:15Z</dc:date>
    </item>
  </channel>
</rss>

