<?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: MC9S12XEP100 Cycle counter in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/MC9S12XEP100-Cycle-counter/m-p/184037#M6879</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is ECT not accurate? How? Do&amp;nbsp;you mean you are going to prescale ECT clock? Just use least 1:1 prescaler and you won't lose accuracy or ECT resolution. Arbitrary timeout periods can be both generated and measured using ECT. Resolution and accuracy is as good as bus clock.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;isr_10ms()&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;static short ect_overflow_counter;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if(ect_overflow_counter)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ect_overflow_counter--;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ect_overflow_counter = 368640L / 65536;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TCx += 368640L&amp;nbsp;% 65536;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; increment_10ms_counter();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; clear_TCx_flag();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Mar 2010 19:20:00 GMT</pubDate>
    <dc:creator>kef</dc:creator>
    <dc:date>2010-03-18T19:20:00Z</dc:date>
    <item>
      <title>MC9S12XEP100 Cycle counter</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/MC9S12XEP100-Cycle-counter/m-p/184036#M6878</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'd like to implement a ten-millisecond counter on my MCU so that the cycle count representing ten milliseconds could be arbitrary. I need this to account for inaccuracies in the internal clock frequency.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example my bus frequency is 36.864.000Hz and each 10ms period would be represented by 368.640 cycles. I get a reference time from a GPS module and I'd like to change this cycle count accordingly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is I don't know how to build a timer mechanism that would fire every n cycles, where n can be over 65536. I've tried to use PIT but it needs the timeout to be n * m cycles so a cycle count that is e.g. a prime number cannot be used and the resolution in general would be the minimum of n and m.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using ECT this could be achieved by dynamically adjusting the compare register with the modulus of the desired cycle count but it seems inaccurate and inelegant.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Seppo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Mar 2010 18:09:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/MC9S12XEP100-Cycle-counter/m-p/184036#M6878</guid>
      <dc:creator>spietari</dc:creator>
      <dc:date>2010-03-18T18:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: MC9S12XEP100 Cycle counter</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/MC9S12XEP100-Cycle-counter/m-p/184037#M6879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is ECT not accurate? How? Do&amp;nbsp;you mean you are going to prescale ECT clock? Just use least 1:1 prescaler and you won't lose accuracy or ECT resolution. Arbitrary timeout periods can be both generated and measured using ECT. Resolution and accuracy is as good as bus clock.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;isr_10ms()&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;static short ect_overflow_counter;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if(ect_overflow_counter)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ect_overflow_counter--;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ect_overflow_counter = 368640L / 65536;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TCx += 368640L&amp;nbsp;% 65536;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; increment_10ms_counter();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; clear_TCx_flag();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Mar 2010 19:20:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/MC9S12XEP100-Cycle-counter/m-p/184037#M6879</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2010-03-18T19:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: MC9S12XEP100 Cycle counter</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/MC9S12XEP100-Cycle-counter/m-p/184038#M6880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perfect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Mar 2010 14:28:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/MC9S12XEP100-Cycle-counter/m-p/184038#M6880</guid>
      <dc:creator>spietari</dc:creator>
      <dc:date>2010-03-23T14:28:46Z</dc:date>
    </item>
  </channel>
</rss>

