<?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 QG8 Delay Timer in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Delay-Timer/m-p/125230#M544</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, I am pretty new to this controller (got the demo board yesterday), and am trying to create a pushbutton power on/off system. I am in need of a delay function that can delay upwards to 1 second. i have written some code that i thought should work, but it doesn't seem to be working. can anyone help me out on this one? Also, at the end of this project, I want the system to be in low power wait/stop3 mode, during all of its waiting (for the button press, or one other signal. Can anyone help me out with this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/*this part is in main function, before the wait func is called*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; EnableInterrupts; /* enable interrupts */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; MTIMCLK_PS = 8;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; MTIMCLK_CLKS = 1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; MTIMMOD = 0xFF;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void longWait()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; timerFlag = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; MTIMMOD = 0xFE;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; MTIMSC = 0x20; /* reset and start MTIM, enable ints */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; MTIMSC = 0; //start it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; while(!MTIMSC_TOF &amp;amp;&amp;amp; PTAD_PTAD2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ; //wait ~1 second, or so&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; MTIMSC = 0x10;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have also attached the whole file.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 30 Jul 2006 01:49:19 GMT</pubDate>
    <dc:creator>airswit</dc:creator>
    <dc:date>2006-07-30T01:49:19Z</dc:date>
    <item>
      <title>QG8 Delay Timer</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Delay-Timer/m-p/125230#M544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, I am pretty new to this controller (got the demo board yesterday), and am trying to create a pushbutton power on/off system. I am in need of a delay function that can delay upwards to 1 second. i have written some code that i thought should work, but it doesn't seem to be working. can anyone help me out on this one? Also, at the end of this project, I want the system to be in low power wait/stop3 mode, during all of its waiting (for the button press, or one other signal. Can anyone help me out with this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/*this part is in main function, before the wait func is called*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; EnableInterrupts; /* enable interrupts */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; MTIMCLK_PS = 8;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; MTIMCLK_CLKS = 1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; MTIMMOD = 0xFF;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void longWait()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; timerFlag = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; MTIMMOD = 0xFE;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; MTIMSC = 0x20; /* reset and start MTIM, enable ints */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; MTIMSC = 0; //start it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; while(!MTIMSC_TOF &amp;amp;&amp;amp; PTAD_PTAD2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ; //wait ~1 second, or so&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; MTIMSC = 0x10;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have also attached the whole file.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Jul 2006 01:49:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Delay-Timer/m-p/125230#M544</guid>
      <dc:creator>airswit</dc:creator>
      <dc:date>2006-07-30T01:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: QG8 Delay Timer</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Delay-Timer/m-p/125231#M545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I got it working...it was a darn watchdog timer problem, i guess. Anyway, all i did was disable the watchdog, and it works now. awesome!&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Jul 2006 08:49:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/QG8-Delay-Timer/m-p/125231#M545</guid>
      <dc:creator>airswit</dc:creator>
      <dc:date>2006-07-30T08:49:53Z</dc:date>
    </item>
  </channel>
</rss>

