<?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>LPC2103 -Timer interrupt problem</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/21958/lpc2103--timer-interrupt-problem</link><description> 
Hi all, 

 
I am using LPC2103,I had configured timer2[16 bit] and i had set
it for MR0 match interrupt and reset the TC on match , 

 
It is working for the first time ,But second time it is not
working [it is not going to the ISR routine]. I had configure</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: LPC2103 -Timer interrupt problem</title><link>https://community.arm.com/thread/135093?ContentTypeID=1</link><pubDate>Thu, 02 Aug 2007 07:42:39 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ba267916-a837-4781-b772-2ac734fdc0d3</guid><dc:creator>Shanid Paul</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;b&gt;Here is the working code&lt;/b&gt; ,In ISR i have wrote one more line
for writing an dummy to VECT.&lt;/p&gt;

&lt;p&gt;
/**************************************************&lt;/p&gt;

&lt;p&gt;
Test APP- Timer 2&lt;b&gt;[Code which has worked ]&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;
****************************************************/&lt;br /&gt;
#include&amp;lt;LPC2103.h&amp;gt;&lt;br /&gt;
void ISR(void);&lt;br /&gt;
int main(void)&lt;br /&gt;
{ int x=0;&lt;/p&gt;

&lt;p&gt;
T2PR = 0x00000005; //Load prescaler&lt;br /&gt;
T2TCR = 0x00000002; //Reset counter and prescaler&lt;br /&gt;
T2MCR = 0x00000003; //match reset the counter and generate an
interrupt&lt;br /&gt;
T2MR0 = 0x00000010; //cycle time&lt;br /&gt;
T2TCR = 0x00000001; //enable timer&lt;/p&gt;

&lt;p&gt;
VICVectAddr4 = (unsigned)ISR; //Set the timer ISR vector
address&lt;br /&gt;
VICVectCntl4 = 0x0000003A; //Set channel control&lt;/p&gt;

&lt;p&gt;
VICIntEnable |= 0x04000000; //Enable the TIMER2 interrupt&lt;/p&gt;

&lt;p&gt;
while(1)&lt;/p&gt;

&lt;p&gt;
{&lt;br /&gt;
x=x+1; //Keeps loop running in single step&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;
}&lt;/p&gt;

&lt;p&gt;
void ISR (void) __irq&lt;br /&gt;
{&lt;/p&gt;

&lt;p&gt;
T2IR = 0x00000001; //Clear match 0 interrupt&lt;br /&gt;
VICVectAddr = 0x00000000; //Dummy write to signal end of
interrupt&lt;/p&gt;

&lt;p&gt;
}&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;&lt;i&gt;thanks&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LPC2103 -Timer interrupt problem</title><link>https://community.arm.com/thread/123984?ContentTypeID=1</link><pubDate>Thu, 02 Aug 2007 07:30:21 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:84985b86-a239-431e-8f98-fca509ea1a07</guid><dc:creator>Shanid Paul</dc:creator><description>&lt;p&gt;&lt;p&gt;
thank you shameel,&lt;/p&gt;

&lt;p&gt;
i got it ,I just enabled the interrupt after configuring the
interrupt .&lt;/p&gt;

&lt;p&gt;
thank alot for your help,&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
Thanks&lt;br /&gt;
Shanid&lt;br /&gt;
+91-8214003008&lt;br /&gt;&lt;/i&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LPC2103 -Timer interrupt problem</title><link>https://community.arm.com/thread/123981?ContentTypeID=1</link><pubDate>Thu, 02 Aug 2007 07:00:44 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f17784dd-b182-429c-ad7e-a07c2a4f294b</guid><dc:creator>MUHAMMED SHAMEEL</dc:creator><description>&lt;p&gt;&lt;p&gt;
also it is better to enable timer after configuring the
interrupt&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LPC2103 -Timer interrupt problem</title><link>https://community.arm.com/thread/113067?ContentTypeID=1</link><pubDate>Thu, 02 Aug 2007 06:56:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:12c19591-7130-4138-89a4-c87d35346fd3</guid><dc:creator>MUHAMMED SHAMEEL</dc:creator><description>&lt;p&gt;&lt;p&gt;
void isr(void) __irq;&lt;/p&gt;

&lt;p&gt;
void isr(void) __irq&lt;br /&gt;
{ }&lt;/p&gt;

&lt;p&gt;
u sure u didnt got?...then go to disassembly check whether the
actual isr is loaded into the corresponding registers.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LPC2103 -Timer interrupt problem</title><link>https://community.arm.com/thread/99495?ContentTypeID=1</link><pubDate>Thu, 02 Aug 2007 04:34:15 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:fbbb28b6-d809-4e0e-9d6a-6f28c3c56689</guid><dc:creator>Shanid Paul</dc:creator><description>&lt;p&gt;&lt;p&gt;
thanks for your reply ,&lt;/p&gt;

&lt;p&gt;
i just tried the way which you told ,but still i am getting the
same answer ,It is going to ISR only once .&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LPC2103 -Timer interrupt problem</title><link>https://community.arm.com/thread/75330?ContentTypeID=1</link><pubDate>Thu, 02 Aug 2007 03:56:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0806b35c-6438-4f22-bf38-ffddb5a83ff6</guid><dc:creator>MUHAMMED SHAMEEL</dc:creator><description>&lt;p&gt;&lt;p&gt;
void ISR (void) __irq&lt;br /&gt;
{ T2IR = 0x0000000F; //Clear match 0 interrupt&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;
u have to add __irq to the isr function&lt;br /&gt;
u try this way u will get it.....&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LPC2103 -Timer interrupt problem</title><link>https://community.arm.com/thread/48376?ContentTypeID=1</link><pubDate>Thu, 02 Aug 2007 01:26:19 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:fb98731d-f226-46e0-bb59-ca5573df070d</guid><dc:creator>Shanid Paul</dc:creator><description>&lt;p&gt;&lt;p&gt;
dear all,&lt;/p&gt;

&lt;p&gt;
Please find the test code which i have tested .&lt;br /&gt;
Here at the first time when MRO maches it will give the interrupt and
program will go to the ISR ,But when the second time MRO matches to
TC it is not going to the ISR . One more thing which i noticed is
that the IR register becomig high in 2nd time ,Still it is not going
to the ISR&lt;/p&gt;

&lt;p&gt;
Is anybody faced this problem before ? Is their any mistakes which
i have done here? Could any body enlight me for this problem&lt;/p&gt;

&lt;p&gt;
/**************************************************&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;Test APP- Timer 2&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;
****************************************************/&lt;br /&gt;
#include&amp;lt;LPC2103.h&amp;gt;&lt;br /&gt;
void ISR(void);&lt;br /&gt;
int main(void)&lt;br /&gt;
{ int x=0;&lt;/p&gt;

&lt;p&gt;
T2PR = 0x00000005; //&lt;i&gt;Load prescaler&lt;/i&gt;&lt;br /&gt;
T2TCR = 0x00000002; //&lt;i&gt;Reset counter and prescaler&lt;/i&gt;&lt;br /&gt;
T2MCR = 0x00000003; //&lt;i&gt;match reset the counter and generate an
interrupt&lt;/i&gt;&lt;br /&gt;
T2MR0 = 0x00000010; //&lt;i&gt;cycle time&lt;/i&gt;&lt;br /&gt;
T2TCR = 0x00000001; //&lt;i&gt;enable timer&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
VICVectAddr4 = (unsigned)ISR; //&lt;i&gt;Set the timer ISR vector
address&lt;/i&gt;&lt;br /&gt;
VICVectCntl4 = 0x0000003A; //&lt;i&gt;Set channel control&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
VICIntEnable |= 0x04000000; //&lt;i&gt;Enable the TIMER2
interrupt&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
while(1)&lt;/p&gt;

&lt;p&gt;
{ x=x+1; //&lt;i&gt;Keeps loop running in single step&lt;/i&gt;&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;
}&lt;/p&gt;

&lt;p&gt;
void ISR (void)&lt;br /&gt;
{ T2IR = 0x0000000F; //&lt;i&gt;Clear match 0 interrupt&lt;/i&gt;&lt;br /&gt;
}&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>