<?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 delay problems in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Timer-delay-problems/m-p/542054#M7672</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by JohnBurton on Thu Jul 08 03:33:26 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, I've looked some more at the examples, and the data sheets and got it all to work.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 22:00:36 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T22:00:36Z</dc:date>
    <item>
      <title>Timer delay problems</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Timer-delay-problems/m-p/542052#M7670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by JohnBurton on Wed Jul 07 06:11:55 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello, I've just started experimenting with an LPCXpresso board with an LPC1434 chip on it and mostly it's going well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However I'm having a little problem with delays and timers and wondered if anyone could see what I'm doing wrong?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the sample code I found a file timer16.h which has a delay_microseconds in it which uses a 16 bit timer to perform the delay. I'm calling it like this &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;#include "timer16.h"

//
// Simple delay of approx ms milliseconds
// Can't delay for very long, so do lots of shorter delays instead
//
void delay_ms(int ms)
{
ms = ms * 10;

while(--ms) {
// Delay for a total of 100uS
delay_microseconds(0, 25);
delay_microseconds(0, 25);
delay_microseconds(0, 25);
delay_microseconds(0, 25);
}
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I call delay_ms(1000) I get a delay of only a short delay and not even close to 1s. All delays are similarly short.&amp;nbsp; I realise this isn't going to be accurate, and I realise there are better ways to use the timer but it concerns me that this doesn't work for me as clearly there is something I don't understand.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Am I calling this function correctly? Is there anything I need to explicitly initialize first such as timer hardware or the system clock?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any thoughts would be welcome &lt;SPAN class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;&lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:00:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Timer-delay-problems/m-p/542052#M7670</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Timer delay problems</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Timer-delay-problems/m-p/542053#M7671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by CodeRedSupport on Wed Jul 07 07:36:44 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;There were some minor issues with regards to early versions of timer16 based examples. If you want to make use of one or more timers, I would suggest making sure that you have the latest LPCXpresso IDE installed (v3.4) and then looking at the following examples:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[LIST]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[*]LPCXpresso1343_blinky - for timer16&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[*]LPCXpresso1343_timer32 - for timer32&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[*]LPCXPresso1343_systick - for system timer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/LIST]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;IDE_Install_Dir&amp;gt;\Examples\LPC1000\LPC13xx\LPCXpresso1343.zip&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The system timer is probably the easiest to set up and make use of.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CodeRedSupport&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:00:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Timer-delay-problems/m-p/542053#M7671</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: Timer delay problems</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Timer-delay-problems/m-p/542054#M7672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by JohnBurton on Thu Jul 08 03:33:26 MST 2010&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, I've looked some more at the examples, and the data sheets and got it all to work.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:00:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Timer-delay-problems/m-p/542054#M7672</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:00:36Z</dc:date>
    </item>
  </channel>
</rss>

