<?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: LPC1769 Timer with 1ms Interrupt in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Timer-with-1ms-Interrupt/m-p/1163215#M42471</link>
    <description>&lt;P&gt;bro i hope you are doing wrong in intializations???&lt;/P&gt;&lt;P&gt;and next thing is it can easily done by PRESCALAR and MR0&lt;/P&gt;&lt;P&gt;where here you take PCLK=CCLK&lt;/P&gt;&lt;P&gt;then at this time you need to set PRESCALAR Register=999999---&amp;gt;(999999+1)==&amp;gt;1000000---&amp;gt;1us&lt;/P&gt;&lt;P&gt;now set MR0=1000.&lt;/P&gt;&lt;P&gt;finally 1us * 1000= 1ms&amp;nbsp;&lt;/P&gt;&lt;P&gt;its so simple!!!!!!!!&lt;/P&gt;</description>
    <pubDate>Tue, 06 Oct 2020 05:13:38 GMT</pubDate>
    <dc:creator>sai_sumanth</dc:creator>
    <dc:date>2020-10-06T05:13:38Z</dc:date>
    <item>
      <title>LPC1769 Timer with 1ms Interrupt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Timer-with-1ms-Interrupt/m-p/644195#M25457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need a Timer with 1 ms Interrupt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it right that the LPC1769 works/counts with 96 MHz default?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SC-&amp;gt;PCONP |= 1 &amp;lt;&amp;lt; 1; //Power up Timer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LPC_SC-&amp;gt;PCLKSEL0 |= 1&amp;lt;&amp;lt;1; //100 MHz&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SC-&amp;gt;PCLKSEL0 |= 1&amp;lt;&amp;lt;1; //96 MHz&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_TIM0-&amp;gt;MR0 = 1000; //1ms&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_TIM0-&amp;gt;MCR |= 1 &amp;lt;&amp;lt; 0; // Interrupt on Match0 compare&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_TIM0-&amp;gt;MCR |= 1 &amp;lt;&amp;lt; 1; // Reset timer on Match 0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_TIM0-&amp;gt;TCR |= 1 &amp;lt;&amp;lt; 1; // Reset Timer0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NVIC_EnableIRQ(TIMER0_IRQn);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I test it with LED ans set " LPC_TIM0-&amp;gt;MR0 = 1000000; //1s". It seems that the LED blink 1s on and off&lt;/P&gt;&lt;P&gt;But I didn't understand the mathematik behind. How can I calculate 1 second with 96MHz und 1000000?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I didn't set "LPC_SC-&amp;gt;PCLKSEL0 |= 1&amp;lt;&amp;lt;1; //96 MHz" It should be the same, because I think 96 is default. But the LED blink different.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you explain me the calculation. With settins I nedd for 1ms , or for example for 1µs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Dec 2016 19:14:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Timer-with-1ms-Interrupt/m-p/644195#M25457</guid>
      <dc:creator>thoret</dc:creator>
      <dc:date>2016-12-27T19:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 Timer with 1ms Interrupt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Timer-with-1ms-Interrupt/m-p/644196#M25458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;LPC_SC-&amp;gt;PCLKSEL0 |= 1&amp;lt;&amp;lt;1; //100 MHz&lt;BR /&gt;&amp;nbsp;&amp;nbsp; LPC_SC-&amp;gt;PCLKSEL0 |= 1&amp;lt;&amp;lt;1; //96 MHz&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code is setting the clock division for the watch dog timer.&amp;nbsp; The timer0 position is at bits 3-2 (div &amp;lt;&amp;lt; 2).&lt;/P&gt;&lt;P&gt;The default for timer 0 is CCLK/4 so you need to write "01" to bits 3-2 (0x01 &amp;lt;&amp;lt; 2) for 100MHz. So the two&lt;/P&gt;&lt;P&gt;lines above don't make any sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The math is easy.&lt;/P&gt;&lt;P&gt;1.You set the clock to the timer with PCLKSEL0.&lt;/P&gt;&lt;P&gt;2. Start the timer and it will count up to your match value and interrupt.&lt;/P&gt;&lt;P&gt;3. The timer resets and counts up again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For 10msec interrupt:&lt;/P&gt;&lt;P&gt;Timer 0 clock = 100MHz clock that would be 100nsec per count.&lt;/P&gt;&lt;P&gt;Desired count timer is 10msec = .01sec,&lt;/P&gt;&lt;P&gt;Every Timer0 count will equal 100nsec.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Number of counts per interrupt = .01 sec / 100nsec per count = 1000000 counts.&amp;nbsp; MR0 = 1000000.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Dec 2016 20:21:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Timer-with-1ms-Interrupt/m-p/644196#M25458</guid>
      <dc:creator>rons</dc:creator>
      <dc:date>2016-12-27T20:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 Timer with 1ms Interrupt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Timer-with-1ms-Interrupt/m-p/644197#M25459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand the clock setting and the math.&lt;/P&gt;&lt;P&gt;But:&lt;/P&gt;&lt;P&gt;Number of counts per interrupt = .01 / 100 nsec per count = &lt;STRONG&gt;100000 counts. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;With &lt;STRONG&gt;5&lt;/STRONG&gt; zeros isn't it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And for a Interrupt with 1 ms:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LPC_TIM0-&amp;gt;MR0 = 10000;&amp;nbsp;&amp;nbsp; //1ms&amp;nbsp;&amp;nbsp; ???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Dec 2016 23:21:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Timer-with-1ms-Interrupt/m-p/644197#M25459</guid>
      <dc:creator>thoret</dc:creator>
      <dc:date>2016-12-27T23:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 Timer with 1ms Interrupt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Timer-with-1ms-Interrupt/m-p/644198#M25460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thore,&lt;/P&gt;&lt;P&gt;I think &lt;SPAN class=""&gt;&lt;A _jive_internal="true" data-content-finding="Community" data-userid="283502" data-username="rons" href="https://community.nxp.com/people/rons"&gt;R Sudjian&lt;/A&gt;&lt;/SPAN&gt; made a mistake, it's the 10nsec per count when the frequency of the Timer is 100 MHz.&lt;/P&gt;&lt;P&gt;So the LPC_TIM0-&amp;gt;MR0 = 1000; is the correct for a interrupt with 1 ms.&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ping&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Dec 2016 06:16:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Timer-with-1ms-Interrupt/m-p/644198#M25460</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2016-12-28T06:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 Timer with 1ms Interrupt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Timer-with-1ms-Interrupt/m-p/644199#M25461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, a typo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Timer clock frequency = 100MHz, or .01usec per count or 10nsec per count&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A 10msec period of time / .01usec per count = .01/.01usec = 1000000&amp;nbsp; = MR0&lt;/P&gt;&lt;P&gt;A 1msec period of time / .01usec per count = .001/.01usec = 100000 = MR0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If MR0=1000 then the period would be&amp;nbsp; .01usec x 1000 = 10usec, not 1 msec,&lt;/P&gt;&lt;P&gt;so jeremyZhou is in error by only a factor of 100.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or use the systick timer on chip or the Repetitive Interrupt Timer (RIT)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; * System Tick Timer values for a 10msec interrupt (100 interrupts per sec)&lt;BR /&gt; *&lt;BR /&gt; * CPU clock(CCLK) = 100MHz&lt;BR /&gt; * RELOAD = number of system clocks -1, (CCLK/100) - 1.&lt;BR /&gt; * or&lt;BR /&gt; * RELOAD = STCALIB, the factory programmed value&lt;BR /&gt; */&lt;BR /&gt;void SysTick_Timer_Init(void)&lt;BR /&gt;{&lt;BR /&gt; systick_count = 0;&lt;BR /&gt; STRELOAD = STCALIB &amp;amp; STCALIB_TENMS_MASK;&lt;BR /&gt; STCTRL = STCTRL_CPUCLK | STCTRL_TICKINT | STCTRL_ENABLE;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void SysTick_Handler(void)&lt;BR /&gt;{&lt;BR /&gt; systick_count++;&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Dec 2016 08:39:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Timer-with-1ms-Interrupt/m-p/644199#M25461</guid>
      <dc:creator>rons</dc:creator>
      <dc:date>2016-12-28T08:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 Timer with 1ms Interrupt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Timer-with-1ms-Interrupt/m-p/1163215#M42471</link>
      <description>&lt;P&gt;bro i hope you are doing wrong in intializations???&lt;/P&gt;&lt;P&gt;and next thing is it can easily done by PRESCALAR and MR0&lt;/P&gt;&lt;P&gt;where here you take PCLK=CCLK&lt;/P&gt;&lt;P&gt;then at this time you need to set PRESCALAR Register=999999---&amp;gt;(999999+1)==&amp;gt;1000000---&amp;gt;1us&lt;/P&gt;&lt;P&gt;now set MR0=1000.&lt;/P&gt;&lt;P&gt;finally 1us * 1000= 1ms&amp;nbsp;&lt;/P&gt;&lt;P&gt;its so simple!!!!!!!!&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2020 05:13:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-Timer-with-1ms-Interrupt/m-p/1163215#M42471</guid>
      <dc:creator>sai_sumanth</dc:creator>
      <dc:date>2020-10-06T05:13:38Z</dc:date>
    </item>
  </channel>
</rss>

