<?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 About MPR121 return value!  in Sensors</title>
    <link>https://community.nxp.com/t5/Sensors/About-MPR121-return-value/m-p/596006#M3610</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;When i use a mpr121,and have wrong return value of the register 0x00,0x01.&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #e23d39;"&gt;when push ELE0,return 0x0000;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE1,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0001;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE2,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0002;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE3,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0004;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE4,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0008;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE5,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0010;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE6,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0020;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #e23d39;"&gt;&lt;SPAN style="font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE7,&lt;SPAN style="font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x00c0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #e23d39;"&gt;&lt;SPAN style="font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE8,&lt;SPAN style="font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0000;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE9,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0001;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE10,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0002;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE11,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0004;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: arial, 宋体; font-size: 13px;"&gt;according to the &lt;SPAN style="color: #000000; font-family: arial, 宋体; font-size: 13px;"&gt;manual,it should be&lt;/SPAN&gt;&lt;/SPAN&gt;：&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE0,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0001;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE1,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0002;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE2,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0004;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE3,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0008;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE4,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0010;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE5,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0020;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE6,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0040;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE7,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0080;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE8,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0100;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE9,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0200;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE10,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0400;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE11,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0800;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;The code is:&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void IIC_MPR121()&lt;BR style="margin: 0 auto;" /&gt;{&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Section A&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // This group controls filtering when data is &amp;gt; baseline.&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,MHD_R, 0x01);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,NHD_R, 0x01);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,NCL_R, 0x02);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,FDL_R, 0x00);&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&amp;nbsp; // Section B&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // This group controls filtering when data is &amp;lt; baseline.&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,MHD_F, 0x01);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,NHD_F, 0x01);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,NCL_F, 0xff);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,FDL_F, 0x00);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; &lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Section C&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // This group sets touch and release thresholds for each electrode&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE0_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE0_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE1_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE1_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE2_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE2_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE3_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE3_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE4_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE4_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE5_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE5_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE6_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE6_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE7_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE7_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE8_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE8_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE9_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE9_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE10_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE10_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE11_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE11_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp; write_i2c(touch_shield,0x5c, 0x30);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Section D&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Set the Filter Configuration&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Set ESI2&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,FIL_CFG, 0x42);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; &lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Section E&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Electrode Configuration&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Enable 6 Electrodes and set to run mode&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Set ELE_CFG to 0x00 to return to standby mode&lt;BR style="margin: 0 auto;" /&gt; // write_i2c(touch_shield,ELE_CFG, 0x0c);&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enables all 12 Electrodes&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; //write_i2c(touch_shield,ELE_CFG, 0x06);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enable first 6 electrodes&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; &lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Section F&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Enable Auto Config and auto Reconfig&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt; write_i2c(touch_shield,ATO_CFG0, 0x0B);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ATO_CFGU, 0xC9);&amp;nbsp;&amp;nbsp;&amp;nbsp; // USL = (Vdd-0.7)/vdd*256 = 0xC9 @3.3V&amp;nbsp;&amp;nbsp; &lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ATO_CFGL, 0x96);&amp;nbsp;&amp;nbsp;&amp;nbsp; // LSL = 0.65*USL = 0x82 @3.3V&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ATO_CFGT, 0xBb);&amp;nbsp;&amp;nbsp;&amp;nbsp; // Target = 0.9*USL = 0xB5 @3.3V&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;write_i2c(touch_shield,ELE_CFG, 0x0c);&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enables all 12 Electrodes&amp;nbsp; &lt;BR style="margin: 0 auto;" /&gt;}&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;BR style="margin: 0 auto;" /&gt;uchar get_key()&lt;BR style="margin: 0 auto;" /&gt;{&lt;BR style="margin: 0 auto;" /&gt; &lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uchar count=0;&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uchar i=0;&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint key_data;&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint key_data2;&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; key_data=read_i2c(touch_shield,0x01)&amp;lt;&amp;lt;8;&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; key_data=key_data| read_i2c(touch_shield,0x00);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; key_data2=key_data;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; for (i=0; i&amp;lt;12; i++)&amp;nbsp; //检测有多少按键被触摸&lt;BR style="margin: 0 auto;" /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR style="margin: 0 auto;" /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ((dat &amp;amp; (1&amp;lt;&amp;lt;i)))&lt;BR style="margin: 0 auto;" /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count++;&lt;BR style="margin: 0 auto;" /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR style="margin: 0 auto;" /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i=0;&lt;BR style="margin: 0 auto;" /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(count==1)&lt;BR style="margin: 0 auto;" /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR style="margin: 0 auto;" /&gt; &lt;BR style="margin: 0 auto;" /&gt; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(((dat &amp;amp; (1&amp;lt;&amp;lt;i)) == 0)&amp;amp;&amp;amp;(i&amp;lt;12))&lt;BR style="margin: 0 auto;" /&gt; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++;&lt;BR style="margin: 0 auto;" /&gt; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++;&lt;BR style="margin: 0 auto;" /&gt; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return i;&lt;BR style="margin: 0 auto;" /&gt; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR style="margin: 0 auto;" /&gt; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(key_data2!=0)&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; key_data2=read_i2c(touch_shield,0x01)&amp;lt;&amp;lt;8;&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; key_data2=key_data2| read_i2c(touch_shield,0x00);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return key_data;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;}&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;i don't know what's the problem? help please.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Aug 2016 12:44:22 GMT</pubDate>
    <dc:creator>hongliangpan</dc:creator>
    <dc:date>2016-08-12T12:44:22Z</dc:date>
    <item>
      <title>About MPR121 return value!</title>
      <link>https://community.nxp.com/t5/Sensors/About-MPR121-return-value/m-p/596006#M3610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;When i use a mpr121,and have wrong return value of the register 0x00,0x01.&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #e23d39;"&gt;when push ELE0,return 0x0000;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE1,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0001;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE2,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0002;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE3,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0004;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE4,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0008;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE5,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0010;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE6,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0020;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #e23d39;"&gt;&lt;SPAN style="font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE7,&lt;SPAN style="font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x00c0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #e23d39;"&gt;&lt;SPAN style="font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE8,&lt;SPAN style="font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0000;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE9,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0001;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE10,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0002;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE11,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0004;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: arial, 宋体; font-size: 13px;"&gt;according to the &lt;SPAN style="color: #000000; font-family: arial, 宋体; font-size: 13px;"&gt;manual,it should be&lt;/SPAN&gt;&lt;/SPAN&gt;：&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE0,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0001;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE1,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0002;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE2,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0004;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE3,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0008;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE4,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0010;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE5,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0020;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE6,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0040;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE7,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0080;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE8,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0100;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE9,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0200;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE10,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0400;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;when push &lt;/SPAN&gt;ELE11,&lt;SPAN style="color: #000000; font-family: Arial, 宋体; font-size: 12px;"&gt;return &lt;/SPAN&gt;0x0800;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;The code is:&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void IIC_MPR121()&lt;BR style="margin: 0 auto;" /&gt;{&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Section A&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // This group controls filtering when data is &amp;gt; baseline.&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,MHD_R, 0x01);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,NHD_R, 0x01);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,NCL_R, 0x02);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,FDL_R, 0x00);&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&amp;nbsp; // Section B&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // This group controls filtering when data is &amp;lt; baseline.&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,MHD_F, 0x01);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,NHD_F, 0x01);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,NCL_F, 0xff);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,FDL_F, 0x00);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; &lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Section C&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // This group sets touch and release thresholds for each electrode&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE0_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE0_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE1_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE1_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE2_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE2_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE3_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE3_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE4_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE4_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE5_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE5_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE6_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE6_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE7_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE7_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE8_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE8_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE9_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE9_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE10_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE10_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE11_T, TOU_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ELE11_R, REL_THRESH);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp; write_i2c(touch_shield,0x5c, 0x30);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Section D&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Set the Filter Configuration&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Set ESI2&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,FIL_CFG, 0x42);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; &lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Section E&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Electrode Configuration&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Enable 6 Electrodes and set to run mode&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Set ELE_CFG to 0x00 to return to standby mode&lt;BR style="margin: 0 auto;" /&gt; // write_i2c(touch_shield,ELE_CFG, 0x0c);&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enables all 12 Electrodes&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; //write_i2c(touch_shield,ELE_CFG, 0x06);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enable first 6 electrodes&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; &lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Section F&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; // Enable Auto Config and auto Reconfig&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt; write_i2c(touch_shield,ATO_CFG0, 0x0B);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ATO_CFGU, 0xC9);&amp;nbsp;&amp;nbsp;&amp;nbsp; // USL = (Vdd-0.7)/vdd*256 = 0xC9 @3.3V&amp;nbsp;&amp;nbsp; &lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ATO_CFGL, 0x96);&amp;nbsp;&amp;nbsp;&amp;nbsp; // LSL = 0.65*USL = 0x82 @3.3V&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp; write_i2c(touch_shield,ATO_CFGT, 0xBb);&amp;nbsp;&amp;nbsp;&amp;nbsp; // Target = 0.9*USL = 0xB5 @3.3V&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;write_i2c(touch_shield,ELE_CFG, 0x0c);&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enables all 12 Electrodes&amp;nbsp; &lt;BR style="margin: 0 auto;" /&gt;}&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&lt;BR style="margin: 0 auto;" /&gt;uchar get_key()&lt;BR style="margin: 0 auto;" /&gt;{&lt;BR style="margin: 0 auto;" /&gt; &lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uchar count=0;&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uchar i=0;&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint key_data;&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint key_data2;&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; key_data=read_i2c(touch_shield,0x01)&amp;lt;&amp;lt;8;&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; key_data=key_data| read_i2c(touch_shield,0x00);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; key_data2=key_data;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; for (i=0; i&amp;lt;12; i++)&amp;nbsp; //检测有多少按键被触摸&lt;BR style="margin: 0 auto;" /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR style="margin: 0 auto;" /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ((dat &amp;amp; (1&amp;lt;&amp;lt;i)))&lt;BR style="margin: 0 auto;" /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count++;&lt;BR style="margin: 0 auto;" /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR style="margin: 0 auto;" /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i=0;&lt;BR style="margin: 0 auto;" /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(count==1)&lt;BR style="margin: 0 auto;" /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR style="margin: 0 auto;" /&gt; &lt;BR style="margin: 0 auto;" /&gt; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(((dat &amp;amp; (1&amp;lt;&amp;lt;i)) == 0)&amp;amp;&amp;amp;(i&amp;lt;12))&lt;BR style="margin: 0 auto;" /&gt; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++;&lt;BR style="margin: 0 auto;" /&gt; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++;&lt;BR style="margin: 0 auto;" /&gt; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return i;&lt;BR style="margin: 0 auto;" /&gt; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR style="margin: 0 auto;" /&gt; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(key_data2!=0)&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; key_data2=read_i2c(touch_shield,0x01)&amp;lt;&amp;lt;8;&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; key_data2=key_data2| read_i2c(touch_shield,0x00);&lt;BR style="margin: 0 auto;" /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return key_data;&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;}&lt;/P&gt;&lt;P style="margin-right: auto; font-family: Arial, 宋体; color: #000000; font-size: 12px;"&gt;i don't know what's the problem? help please.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2016 12:44:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/About-MPR121-return-value/m-p/596006#M3610</guid>
      <dc:creator>hongliangpan</dc:creator>
      <dc:date>2016-08-12T12:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: About MPR121 return value!</title>
      <link>https://community.nxp.com/t5/Sensors/About-MPR121-return-value/m-p/596007#M3611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I also need a &lt;SPAN style="color: #000000;"&gt;&lt;A href="https://tracktrace.onl/usps/" style="color: #000000;"&gt;usps tracking&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;little help with this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Aug 2019 08:45:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/About-MPR121-return-value/m-p/596007#M3611</guid>
      <dc:creator>shaneggpierce</dc:creator>
      <dc:date>2019-08-01T08:45:14Z</dc:date>
    </item>
  </channel>
</rss>

