<?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: Code Optimize in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Code-Optimize/m-p/211144#M18109</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hello, a couple of months ago i did a FIR and a IIR filter in the AW60, they were like 11 order or so, and the sampling frecuency was 5 KHz for one of them and 4 KHz for the other. I use the 10 bits ADC&amp;nbsp; from the AW60&amp;nbsp; for the input and a serial 10 bits DAC for the output. I used the math subroutines from the "AN1219-M68HC08 Integer Math Routines" and 20MHz bus frecuency. They are very slow filters if you take a look at the 20Mhz bus, but i never try to optimize the algoritms. Why do you say that you algorithm is slow, what sampling frecuency are you getting. The first thing to optimize my filter would be a parallel very fast DAC.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 Dec 2008 12:11:53 GMT</pubDate>
    <dc:creator>Morph19</dc:creator>
    <dc:date>2008-12-19T12:11:53Z</dc:date>
    <item>
      <title>Code Optimize</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Code-Optimize/m-p/211143#M18108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; I am using MC13213 which is a hcs08 core to do FIR filiter calculation. However there are too many 16bit&amp;nbsp;multiply 16bit data in this algorithm, so the time is too long. Is there anyone can give me some good ideas on how to simply this work or a better skill on multiplication? Thank you!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Sincerely&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Vincent&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Dec 2008 10:40:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Code-Optimize/m-p/211143#M18108</guid>
      <dc:creator>VincentLau</dc:creator>
      <dc:date>2008-12-18T10:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimize</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Code-Optimize/m-p/211144#M18109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hello, a couple of months ago i did a FIR and a IIR filter in the AW60, they were like 11 order or so, and the sampling frecuency was 5 KHz for one of them and 4 KHz for the other. I use the 10 bits ADC&amp;nbsp; from the AW60&amp;nbsp; for the input and a serial 10 bits DAC for the output. I used the math subroutines from the "AN1219-M68HC08 Integer Math Routines" and 20MHz bus frecuency. They are very slow filters if you take a look at the 20Mhz bus, but i never try to optimize the algoritms. Why do you say that you algorithm is slow, what sampling frecuency are you getting. The first thing to optimize my filter would be a parallel very fast DAC.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Dec 2008 12:11:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Code-Optimize/m-p/211144#M18109</guid>
      <dc:creator>Morph19</dc:creator>
      <dc:date>2008-12-19T12:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimize</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Code-Optimize/m-p/211145#M18110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Thank you again for your reply, Morph19.&amp;nbsp;I&amp;nbsp;am using a Kaiser window FIR filter to smooth noise&amp;nbsp;that is great than 5 Hz when the sample frequence is 100 Hz and order is 25! I test it on MC13213&amp;nbsp;which bus frequence is 8 MHz. However, what a pity is that it almost spends 12 seconds on processing 512 sampling data.I think that too many const float data multiplication from Kaiser window&amp;nbsp;may be an hard work for an 8-bit MCU. How can I fix it by a skill way?&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Dec 2008 14:59:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Code-Optimize/m-p/211145#M18110</guid>
      <dc:creator>VincentLau</dc:creator>
      <dc:date>2008-12-31T14:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimize</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Code-Optimize/m-p/211146#M18111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Morph19 suggested you using integer only routines. That would be way faster.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Is your 512 samples buffer integer or float? Conversion from float to int and back can take&amp;nbsp;a lot of time. And FIR code, I guess,&amp;nbsp;iterates more than once through this buffer.&amp;nbsp;Making buffer float could improve the speed.&lt;/DIV&gt;&lt;DIV&gt;Could you show your filter code? Someone could give you more ideas.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;BTW for some weird reasons, maybe optimization for size,&amp;nbsp;HC(S)08 Codewarrior floating point multiply routines aren't using hardware multiplier (8x8-&amp;gt;16bit MUL instruction). Of course that's slow.&amp;nbsp;Multiply routine takes almost 4000 bus cycles on non zero and&amp;nbsp;finite arguments. Using&amp;nbsp;MUL it could&amp;nbsp;take less than 700 cycles.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Dec 2008 16:22:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Code-Optimize/m-p/211146#M18111</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2008-12-31T16:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimize</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Code-Optimize/m-p/211147#M18112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Ok. I paste my code here. Maybe it is &amp;nbsp;a liitle "puerile" code. &lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;const float H[25]={ 0,0,0, 0.0012,0.0035,0.0024,-0.0088,-0.0269,-0.0272,0.0243,&amp;nbsp;&amp;nbsp; 0.1326,&amp;nbsp;&amp;nbsp; 0.249,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.3,0.2492,0.1326,0.0243,-0.0272,-0.0269,-0.0088,0.0024,0.0035, 0.0012,0,0,0};&lt;/DIV&gt;&lt;DIV&gt;unsigned int Original_Data[512];&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;void FIR_Filter(void){&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned int i,j;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; float temp=0.0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(i=24;i&amp;lt;512;i++){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(j=0;j&amp;lt;25;j++){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; temp+=( H[j] * Original_Data[i-j] );&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Original_Data[(i-24)]=(unsigned int) temp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; temp=0.0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks a lot to anyone who&amp;nbsp;gives&amp;nbsp;me ideas!&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Jan 2009 23:29:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Code-Optimize/m-p/211147#M18112</guid>
      <dc:creator>VincentLau</dc:creator>
      <dc:date>2009-01-02T23:29:07Z</dc:date>
    </item>
  </channel>
</rss>

