<?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: Timer in MC9S08GT60 in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Timer-in-MC9S08GT60/m-p/207907#M17647</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Poornima,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Find a divisor setup which will make 65536 counts last longer than one second.&amp;nbsp; Get as short as possible without going less than one second.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Calculate the exact number of counts for one second and set this as the modulo.&amp;nbsp; If it is not exact and you need EXACT for the long term you may need to adjust the modulo count at each interrupt to make sure the long term count is exact.&amp;nbsp; If you need EXACT over the short term, then you will possibly need to change crystals - I do not think this will be the case for an 8 MHz crystal as I believe there is an exact divisor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Enable the Overflow interrupt and put some code in it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good Luck,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Peter House&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Aug 2009 21:25:33 GMT</pubDate>
    <dc:creator>PeterHouse</dc:creator>
    <dc:date>2009-08-17T21:25:33Z</dc:date>
    <item>
      <title>Timer in MC9S08GT60</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Timer-in-MC9S08GT60/m-p/207906#M17646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My application code requires me to send data through the SPI interface every one minute. I want to write an interrupt routine using the timer. I am using MC9S08GT60, running at 8MHz.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not sure how to initialize the timer module. And set the register values to get an interrupt every one minute.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Poornima&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2009 15:58:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Timer-in-MC9S08GT60/m-p/207906#M17646</guid>
      <dc:creator>ppanicker</dc:creator>
      <dc:date>2009-08-17T15:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: Timer in MC9S08GT60</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Timer-in-MC9S08GT60/m-p/207907#M17647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Poornima,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Find a divisor setup which will make 65536 counts last longer than one second.&amp;nbsp; Get as short as possible without going less than one second.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Calculate the exact number of counts for one second and set this as the modulo.&amp;nbsp; If it is not exact and you need EXACT for the long term you may need to adjust the modulo count at each interrupt to make sure the long term count is exact.&amp;nbsp; If you need EXACT over the short term, then you will possibly need to change crystals - I do not think this will be the case for an 8 MHz crystal as I believe there is an exact divisor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Enable the Overflow interrupt and put some code in it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good Luck,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Peter House&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2009 21:25:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Timer-in-MC9S08GT60/m-p/207907#M17647</guid>
      <dc:creator>PeterHouse</dc:creator>
      <dc:date>2009-08-17T21:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: Timer in MC9S08GT60</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Timer-in-MC9S08GT60/m-p/207908#M17648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Poomima,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't think that it is possible to directly achieve a 1 minute TPM overflow period with a bus frequency of 8MHz.&amp;nbsp; However, if a&amp;nbsp;much shorter TPM overflow period, perhaps 10 milliseconds, is generated, a one minute timeout period could then be achieved by counting every 6000 overflows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With a bus frequency of 8 MHz, a TPMMOD setting of 39999 and a prescale value of 2 should give 10 ms overflow period.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using an 16-bit global variable &lt;FONT face="courier new,courier"&gt;tcount&lt;/FONT&gt;, the TPM overflow ISR then might incorporate the following code snippet:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;tcount--;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;if (tcount == 0) {&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;tcount = 6000;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;SPI_process();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;}&lt;/FONT&gt;&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-08-18&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;05:07 AM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 01:56:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Timer-in-MC9S08GT60/m-p/207908#M17648</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2009-08-18T01:56:10Z</dc:date>
    </item>
  </channel>
</rss>

