<?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>8-bit Microcontrollers中的主题 Re: LF_II</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LF-II/m-p/180533#M13082</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;great explanation,thank you so much bigmac,&lt;/P&gt;&lt;P&gt;after test this code again i will contact you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;...Juliet&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by poppy2008 on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-05-14&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;08:17 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 May 2009 10:16:18 GMT</pubDate>
    <dc:creator>poppy2008</dc:creator>
    <dc:date>2009-05-15T10:16:18Z</dc:date>
    <item>
      <title>LF_II</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LF-II/m-p/180529#M13078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can any one tell me what this export symbol XDEF &lt;STRONG&gt;LF_II&lt;/STRONG&gt;&amp;nbsp; function doing.?,i couldnt understand from assembly codes,please&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 May 2009 15:59:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LF-II/m-p/180529#M13078</guid>
      <dc:creator>poppy2008</dc:creator>
      <dc:date>2009-05-12T15:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: LF_II</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LF-II/m-p/180530#M13079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear peg,bigmac &amp;nbsp;help me,please&lt;/P&gt;&lt;P&gt;(actually&amp;nbsp;for rms current calculation,&amp;nbsp;this library function is used in one program &amp;nbsp;,i want to know what &amp;nbsp;this fn doing)&amp;nbsp;&lt;/P&gt;&lt;P&gt;here i &amp;nbsp;have attached the LF_II code&amp;nbsp;&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by poppy2008 on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-05-12&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;10:30 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by poppy2008 on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-05-12&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;10:31 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2009 12:26:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LF-II/m-p/180530#M13079</guid>
      <dc:creator>poppy2008</dc:creator>
      <dc:date>2009-05-13T12:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: LF_II</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LF-II/m-p/180531#M13080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as I can judge, the sub-routine seems to be calculating the "mean-squared" value of the 10-bit Iac_10b unsigned value, and placing the 20-bit result within an assumed 24-bit variable Iac_LFR.&amp;nbsp; The filtering algorithm (to obtain the mean) is unknown to me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code is poorly written on at least two counts -&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The almost complete absence of comments to describe the purpose of the sub-routine, and the operation of each section of the code. There may also be some unexplained initialisation requirements for some of the registers.&lt;/LI&gt;&lt;LI&gt;Some of the variables allocated within Z_RAM seem to have only temporary use.&amp;nbsp; For HCS08 devices, the stack would be better used for these.&amp;nbsp; The current usage of dedicated RAM is about 30 bytes.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The following comments describe what each section of code seems to be doing.&amp;nbsp; Perhaps others may be able to explain the filtering method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Square 10-bit value: result -&amp;gt; IX&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Calculate IX += IY&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Right shift IY by 6 places&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Calculate IY = IX - IY&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; SECOND FILTER&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Calculate IT = IY - IZ&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Right shift IT by 6 places&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Calculate IZ += IT; IR = IZ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Right shift IR by 6 places&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Calculate Iac_LFR = IR + 2 (20-bit result)&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 12:47:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LF-II/m-p/180531#M13080</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2009-05-14T12:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: LF_II</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LF-II/m-p/180532#M13081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made a further attempt to understand the operation of the filter algorithm, and it appears that a standard form of filter is actually used, that gives results close to a single RC circuit in the analog domain. In fact the filter is applied twice, to give the effect of two cascaded CR circuits with equal time constants.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The registers IY and IZ are the filtered values, that must remain static, and must be initialised. Also keep in mind that shift right 6 places is identical to divide by 64. So the calculation of each updated filtered value may be derived.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;IY = IX + IY*63/64&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;IZ = IY + IZ*63/64&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each filtered value is 64 times greater than the final mean (20-bit) value. This is why IZ needs to be divided by 64. I am not sure why the final value has then been incremented by 2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also observe that the dword registers IX, IR and IT are for temporary use only, and only a single register (say IX) is actually necessary. This should reduce the dedicated RAM requirement to 12 bytes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attempted to "clean up" the code, but the attached code remains untested so there might possibly be some overlooked errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by bigmac on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-05-14&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;10:21 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2009 18:53:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LF-II/m-p/180532#M13081</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2009-05-14T18:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: LF_II</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/LF-II/m-p/180533#M13082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;great explanation,thank you so much bigmac,&lt;/P&gt;&lt;P&gt;after test this code again i will contact you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;...Juliet&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by poppy2008 on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-05-14&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;08:17 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 May 2009 10:16:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/LF-II/m-p/180533#M13082</guid>
      <dc:creator>poppy2008</dc:creator>
      <dc:date>2009-05-15T10:16:18Z</dc:date>
    </item>
  </channel>
</rss>

