<?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>LPCXpresso IDEのトピックRe: TIMER16 Prescale Error</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/TIMER16-Prescale-Error/m-p/595832#M31545</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Rob65 on Sat Mar 31 12:26:27 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;No idea what I did just a few hours ago ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;0 == div by 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 == div by 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so indeed there should be a -1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A simple formula in the user manual instead of the descriptive text would explain this much nicer ( Timer clock = PCLK / (PR + 1) )&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure if this will be fixed in the next version.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There have been multiple 'bug fixes' in other drivers and examples that are still not implemented in the new examples.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As you figured out by now: never trust the examples (or an engineer telling you they are correct ;)).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Still LPCXpresso (the eclipse IDE with compiler and debugger) is indeed a great tool and the LPCXpresso boards are great targets to start development and for most applications you don't need anything else.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But take care when using the LPCXpresso examples: these are mainly delivered 'as is' - they do work but may include some 'bugs' like a slightly wrong timing, no error handling etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Use them as examples to base your own drivers and application code on and you'll find them quite handy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,[INDENT]Rob&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/INDENT]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 22:58:00 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T22:58:00Z</dc:date>
    <item>
      <title>TIMER16 Prescale Error</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/TIMER16-Prescale-Error/m-p/595829#M31542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by jagweb on Sat Mar 31 06:12:54 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;This is my first post so please be gentle.&amp;nbsp; I have been working with the 16 bit timers using the LPC1114 and the driver library provided in version 4.2.0 Build 264.&amp;nbsp; My timing was off by around 2% and was having some difficulty finding the root cause.&amp;nbsp; I searched way too long to find out it was an off by one error.&amp;nbsp; The problem is with the MHZ_PRESCALE define in the timer16.h driver code.&amp;nbsp; When you set the prescaler to 48 you are actually dividing by 49 because the prescaler by design is off by 1.&amp;nbsp;&amp;nbsp; so the define should be (TIMER _CLOCKFREQ/1000000-1).&amp;nbsp; I really hope this helps someone else. It would be nice to see this fix incorporated on the next version or build.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In general, I think the LPCXpresso is a great tool :) and appreciate free tools for evalution and small projects.&amp;nbsp; The example projects are nice and get you running very fast.&amp;nbsp; My general impression of the M0 parts is they are simple to use (this is not always the case with other vendors).&amp;nbsp; Keep up the good work.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:57:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/TIMER16-Prescale-Error/m-p/595829#M31542</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: TIMER16 Prescale Error</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/TIMER16-Prescale-Error/m-p/595830#M31543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Rob65 on Sat Mar 31 07:10:41 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;welcome,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;why do you think the prescaler is by design offset by 1 ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I read the user manual (section 15.7.5 Prescale Counter) I read:&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;When it reaches the value stored in the Prescale Register,&lt;BR /&gt;the Timer Counter is incremented, and the Prescale Counter is reset on the next PCLK.&lt;BR /&gt;This causes the TC to increment on every PCLK when PR = 0, every 2 PCLKs when&lt;BR /&gt;PR = 1, etc.&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So there is no offset by 1 as far as I can see. With a 12 MHZ clock setting the prescaler to 12 will divide by 12 resulting in a 1 MHz resolution of the timer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But I could be wrong - it's been a while since I've actually used my lpc1114 board.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]Rob&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/INDENT]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:57:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/TIMER16-Prescale-Error/m-p/595830#M31543</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: TIMER16 Prescale Error</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/TIMER16-Prescale-Error/m-p/595831#M31544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Sat Mar 31 07:23:08 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: jagweb&lt;/STRONG&gt;&lt;BR /&gt;This is my first post so please be gentle. :)&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Of course you are right :), a lot of samples here show the same prescale setting:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://"&gt;http://knowledgebase.nxp.com/showthread.php?t=2815&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:57:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/TIMER16-Prescale-Error/m-p/595831#M31544</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: TIMER16 Prescale Error</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/TIMER16-Prescale-Error/m-p/595832#M31545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Rob65 on Sat Mar 31 12:26:27 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;No idea what I did just a few hours ago ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;0 == div by 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 == div by 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so indeed there should be a -1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A simple formula in the user manual instead of the descriptive text would explain this much nicer ( Timer clock = PCLK / (PR + 1) )&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure if this will be fixed in the next version.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There have been multiple 'bug fixes' in other drivers and examples that are still not implemented in the new examples.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As you figured out by now: never trust the examples (or an engineer telling you they are correct ;)).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Still LPCXpresso (the eclipse IDE with compiler and debugger) is indeed a great tool and the LPCXpresso boards are great targets to start development and for most applications you don't need anything else.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But take care when using the LPCXpresso examples: these are mainly delivered 'as is' - they do work but may include some 'bugs' like a slightly wrong timing, no error handling etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Use them as examples to base your own drivers and application code on and you'll find them quite handy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,[INDENT]Rob&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/INDENT]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:58:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/TIMER16-Prescale-Error/m-p/595832#M31545</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: TIMER16 Prescale Error</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/TIMER16-Prescale-Error/m-p/595833#M31546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by galih on Sun Apr 08 03:12:07 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, all. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How to set Timer16 Prescale value and MR0 value to get 1 second (from start until interrupt)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:58:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/TIMER16-Prescale-Error/m-p/595833#M31546</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: TIMER16 Prescale Error</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/TIMER16-Prescale-Error/m-p/595834#M31547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Sun Apr 08 04:30:59 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Link of #3 in this thread shows an example :)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's generating a 1 microsecond Interrupt at 48MHz with prescaler 48 :eek:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So what do you think, can you try to calculate a solution yourself?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:58:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/TIMER16-Prescale-Error/m-p/595834#M31547</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: TIMER16 Prescale Error</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/TIMER16-Prescale-Error/m-p/595835#M31548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by researchinnovation on Thu Apr 12 02:09:22 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=4][B][COLOR=Blue]Hi...!!! &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to take/read file(.txt format doc format) continuously as an input for one of my application on I2C.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; But when I use FILE *file and file =fopen("filename.txt","r"); it is&amp;nbsp;&amp;nbsp; showing error and I tried few more things but it is showing error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have used #include "debug_printf.h" , #include "stdlib.h" and other required driver files, but still error is coming.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please guide me on this or share any document available on c functions for LPCxpresso.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks....:)[/COLOR][/B][/SIZE]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:58:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/TIMER16-Prescale-Error/m-p/595835#M31548</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:58:02Z</dc:date>
    </item>
  </channel>
</rss>

