<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>LPC1768 Timer Interupt</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/29116/lpc1768-timer-interupt</link><description> 
Hello, 

 
Please help confirm if my logic is right regarding timer interupt
using NVIC based on the below code. 
1) I can only receive or display on LCD 1 value each 3124 counts and
the rest of idstring[94] values are blank. 
2) Do ADC clock and Timer</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: LPC1768 Timer Interupt</title><link>https://community.arm.com/thread/106451?ContentTypeID=1</link><pubDate>Mon, 08 Oct 2012 17:19:23 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:41ed0fd0-cbdd-4b98-8dc3-35a1462a0f6a</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
You can disable the interrupt when you don&amp;#39;t more interrupts.&lt;/p&gt;

&lt;p&gt;
But note that you talk about measuring for 3 seconds. That is
3*8000 = 24000 samples. Your array is 96 elements long.&lt;/p&gt;

&lt;p&gt;
You insert at 8kHz, i.e. every 125us.&lt;br /&gt;
You consume at 20Hz, every 50ms.&lt;/p&gt;

&lt;p&gt;
Either you need a longer array, or start to eat at a higher pace,
or slow down the data collection when the consumer gets too far
behind.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LPC1768 Timer Interupt</title><link>https://community.arm.com/thread/80620?ContentTypeID=1</link><pubDate>Mon, 08 Oct 2012 17:09:14 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:891b5da0-33fc-480e-9df1-6ce14ebcacdc</guid><dc:creator>Ming H</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Per,&lt;/p&gt;

&lt;p&gt;
Thank you for your valuable suggestion about&lt;/p&gt;

&lt;pre&gt;
 enum{}..
&lt;/pre&gt;

&lt;p&gt;
I was monkey sees monkey does from on the sample code.&lt;/p&gt;

&lt;p&gt;
Still fuzzy a little about timer interupt:&lt;br /&gt;
Does the interupt interupt continuely through the program? In this
case, it interupts each 125us per sample forever?&lt;br /&gt;
How could I stop an interupt at certain time? Let&amp;#39;s say a signal
transfers data in 3 seconds.&lt;/p&gt;

&lt;p&gt;
Thanks in advance.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LPC1768 Timer Interupt</title><link>https://community.arm.com/thread/67753?ContentTypeID=1</link><pubDate>Mon, 08 Oct 2012 09:35:18 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f3fa7192-a131-49af-8bbd-b611046075d9</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Your timer tick has a big issue - it continues to read 8000
samples/second. But your array only have room for 96 entries.&lt;/p&gt;

&lt;p&gt;
After 12 ms you run out of array space - where do you think your
interrupt will write data then?&lt;/p&gt;

&lt;p&gt;
Next thing - you like to have a global variable named &amp;quot;j&amp;quot;? Is it
even possible to find a more non-descriptive name of a variable?&lt;/p&gt;

&lt;pre&gt;
LPC_TIM0-&amp;gt;MR0          = 3124;            // 1/(8000Hz) = 125 uS = 3125-1 counts @ 40nS/tick
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
Why did you manually compute the value 3124? 40ns (note small &amp;quot;s&amp;quot; for
second - large &amp;quot;S&amp;quot; for Siemens) means 25 MHz peripherial clock. Why
not write something like:&lt;/p&gt;

&lt;pre&gt;
enum {
    PCLK_TIMER0 = 25000000,  // Supply 25 MHz peripherial clock to timer 0.
    TIMER0_FREQ = 8000,      // Want 8 kHz to start ADC conversion.
};
...
LPC_TIM0-&amp;gt;MR0 = (PCLK_TIMER0/TIMER0_FREQ)-1;
&lt;/pre&gt;

&lt;p&gt;
Yes - more text. But wouldn&amp;#39;t it be more readable? And easier to
modify the code in case you want to change PCLK or the sampling rate
for the ADC?&lt;/p&gt;

&lt;p&gt;
Another thing - why not let the timer interrupt start the
conversion and then use an ADC interrupt when conversion is done?
Then you don&amp;#39;t lock up the processor inside an interrupt. Interrupts
should always try to be as fast as possible. Especially if you don&amp;#39;t
allow nested interrupts.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>