<?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>S12 / MagniV MicrocontrollersのトピックProblem with m9s12ne64 timer</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problem-with-m9s12ne64-timer/m-p/183216#M6809</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I can't understand how can i make o/p compare , I wrote a function which make time delay&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;void delay(void){&lt;BR /&gt;&amp;nbsp;TIOS_IOS4 = 1;&amp;nbsp;&amp;nbsp; // timer 4 output compare&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TSCR2_PR = 7;&amp;nbsp;&amp;nbsp;&amp;nbsp; // prescaler 0 : 25Mhz&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TIE_C4I = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // interrupt 4 enable&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TSCR1_TSFRZ = 1; // disable timer in freeze mode&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TC4 = 0xfffc;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TSCR1_TEN = 1;&amp;nbsp;&amp;nbsp; // enable timer&lt;BR /&gt;&amp;nbsp;&amp;nbsp; while(TFLG1_C4F =0 );&lt;BR /&gt;&amp;nbsp;&amp;nbsp; TSCR1_TEN = 0;&amp;nbsp;&amp;nbsp;//disable timer&lt;BR /&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;but it didn't and i don't know why , please if any one read this and find the problem reply to me&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 27 Jan 2008 16:48:41 GMT</pubDate>
    <dc:creator>Mahmoud</dc:creator>
    <dc:date>2008-01-27T16:48:41Z</dc:date>
    <item>
      <title>Problem with m9s12ne64 timer</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problem-with-m9s12ne64-timer/m-p/183216#M6809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I can't understand how can i make o/p compare , I wrote a function which make time delay&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;void delay(void){&lt;BR /&gt;&amp;nbsp;TIOS_IOS4 = 1;&amp;nbsp;&amp;nbsp; // timer 4 output compare&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TSCR2_PR = 7;&amp;nbsp;&amp;nbsp;&amp;nbsp; // prescaler 0 : 25Mhz&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TIE_C4I = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // interrupt 4 enable&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TSCR1_TSFRZ = 1; // disable timer in freeze mode&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TC4 = 0xfffc;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TSCR1_TEN = 1;&amp;nbsp;&amp;nbsp; // enable timer&lt;BR /&gt;&amp;nbsp;&amp;nbsp; while(TFLG1_C4F =0 );&lt;BR /&gt;&amp;nbsp;&amp;nbsp; TSCR1_TEN = 0;&amp;nbsp;&amp;nbsp;//disable timer&lt;BR /&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;but it didn't and i don't know why , please if any one read this and find the problem reply to me&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 Jan 2008 16:48:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problem-with-m9s12ne64-timer/m-p/183216#M6809</guid>
      <dc:creator>Mahmoud</dc:creator>
      <dc:date>2008-01-27T16:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with m9s12ne64 timer</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problem-with-m9s12ne64-timer/m-p/183217#M6810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;TIE_C4I = 0;&lt;BR /&gt;You set this to 1 to enable the interrupt.&lt;BR /&gt;&lt;I&gt;"The bits in TIE correspond bit-for-bit with the bits in the TFLG1 status register. If cleared, the corresponding flag is disabled from causing a hardware interrupt. If set, the corresponding flag is enabled to cause a interrupt"&lt;/I&gt;&lt;BR /&gt;&lt;BR /&gt;while(TFLG1_C4F =0 );&amp;nbsp; You mean '=='&lt;BR /&gt;&lt;BR /&gt;if&amp;nbsp; you learn to write:&lt;BR /&gt;while(&amp;nbsp; 0 == TFLG1_C4F&amp;nbsp; ); Then the compiler will flag this common error.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;TC4 = 0xfffc;&amp;nbsp; I think you want TC4 = TCNT + mydelay;&lt;BR /&gt;Otherwise you will get a random delay depending upon the value of TCNT.&lt;BR /&gt;&lt;BR /&gt;TSCR2_PR = 7;&amp;nbsp;&amp;nbsp;&amp;nbsp; // prescaler 0 : 25Mhz (7= Divide by 128)&lt;BR /&gt;You should set the prescaler before you need to use the delay:&lt;BR /&gt;&lt;I&gt;"The newly selected prescale factor will not take effect until the next synchronized edge where all prescale counter stages equal zero."&lt;/I&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN class="time_text"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by JimDon on &lt;SPAN class="date_text"&gt;2008-01-27&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;09:50 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 Jan 2008 22:43:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problem-with-m9s12ne64-timer/m-p/183217#M6810</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-01-27T22:43:33Z</dc:date>
    </item>
  </channel>
</rss>

