Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Timer/counter interrupt

Timer/counter interrupt

2006-05-29 by Mukund Deshmukh

Hi,

I have come across strange problem of time interrupt. My timer interrupt
routine is very simple.

void __attribute__ ((interrupt("IRQ"))) tc0_cmp(void);

/* Timer0 Compare-Match Interrupt Handler (ISR) */

void tc0_cmp(void)

{

T0FLG=1;

main1000++;

// haul1000++;

T0IR = TxIR_MR0_FLAG; // Clear interrupt flag by writing 1 to Bit 0

VICVectAddr = 0; // Acknowledge Interrupt (rough?)

}

The interrupt works ok. The moment I uncomment  haul1000++, the first
interrupt works and there after stops.

In short if  I increment one variable it works, if I  increment more than
one variable it stops.

The processor is LPC2138 and this is the only interrupt I am using.


Best Regards,

Mukund Deshmukh.
Beta Computronics Pvt Ltd
10/1, IT Park, Parsodi,
Nagpur-440022
Cell - 9422113746

Re: Timer/counter interrupt

2006-05-29 by Karl Olsen

--- In lpc2000@yahoogroups.com, Mukund Deshmukh <betacomp_ngp@...> 
wrote:
>
> Hi,
> 
> I have come across strange problem of time interrupt. My timer
> interrupt routine is very simple.
> 
> void __attribute__ ((interrupt("IRQ"))) tc0_cmp(void);
> 
> /* Timer0 Compare-Match Interrupt Handler (ISR) */
> 
> void tc0_cmp(void)
> 
> {
> 
> T0FLG=1;
> 
> main1000++;
> 
> // haul1000++;
> 
> T0IR = TxIR_MR0_FLAG; // Clear interrupt flag by writing 1 to Bit 0
> 
> VICVectAddr = 0; // Acknowledge Interrupt (rough?)
> 
> }
> 
> The interrupt works ok. The moment I uncomment  haul1000++, the
> first interrupt works and there after stops.
> 
> In short if  I increment one variable it works, if I  increment
> more than one variable it stops.
> 
> The processor is LPC2138 and this is the only interrupt I am using.

What version of GCC are you using?  Version 3.3 and older had bugs in 
the interrupt entry/exit code that could show up like this.

Karl Olsen

Re: [lpc2000] Re: Timer/counter interrupt

2006-05-30 by Mukund Deshmukh

> > I have come across strange problem of time interrupt. My timer
> > interrupt routine is very simple.
> > 
> > void __attribute__ ((interrupt("IRQ"))) tc0_cmp(void);
> > 
> > /* Timer0 Compare-Match Interrupt Handler (ISR) */
> > 
> > void tc0_cmp(void)
> > 
> > {
> > 
> > T0FLG=1;
> > 
> > main1000++;
> > 
> > // haul1000++;
> > 
> > T0IR = TxIR_MR0_FLAG; // Clear interrupt flag by writing 1 to Bit 0
> > 
> > VICVectAddr = 0; // Acknowledge Interrupt (rough?)
> > 
> > }
> > 
> > The interrupt works ok. The moment I uncomment  haul1000++, the
> > first interrupt works and there after stops.
> > 
> > In short if  I increment one variable it works, if I  increment
> > more than one variable it stops.
> > 
> > The processor is LPC2138 and this is the only interrupt I am using.
> 
> What version of GCC are you using?  Version 3.3 and older had bugs in 
> the interrupt entry/exit code that could show up like this.
> 

No its winarm with gcc 4.0.


Best Regards,

Mukund Deshmukh.
Beta Computronics Pvt Ltd
10/1, IT Park, Parsodi,
Nagpur-440022
Cell - 9422113746

Re: Timer/counter interrupt

2006-05-30 by brendanmurphy37

Mukund,

Personally, I'd avoid the use of "interrupt" extensions to the 
language. Not for the first time, I'd highly recommend the following:

http://www.ovro.caltech.edu/~dwh/ucos/project_AR1803.pdf

This has an excellent explanation of how to set up interrupts on the 
LPC2xxx.

Brendan

--- In lpc2000@yahoogroups.com, Mukund Deshmukh <betacomp_ngp@...> 
wrote:
>
> > > I have come across strange problem of time interrupt. My timer
> > > interrupt routine is very simple.
> > > 
> > > void __attribute__ ((interrupt("IRQ"))) tc0_cmp(void);
> > > 
> > > /* Timer0 Compare-Match Interrupt Handler (ISR) */
> > > 
> > > void tc0_cmp(void)
> > > 
> > > {
> > > 
> > > T0FLG=1;
> > > 
> > > main1000++;
> > > 
> > > // haul1000++;
> > > 
> > > T0IR = TxIR_MR0_FLAG; // Clear interrupt flag by writing 1 to 
Bit 0
> > > 
> > > VICVectAddr = 0; // Acknowledge Interrupt (rough?)
> > > 
> > > }
> > > 
> > > The interrupt works ok. The moment I uncomment  haul1000++, the
> > > first interrupt works and there after stops.
> > > 
> > > In short if  I increment one variable it works, if I  increment
> > > more than one variable it stops.
> > > 
> > > The processor is LPC2138 and this is the only interrupt I am 
using.
> > 
> > What version of GCC are you using?  Version 3.3 and older had 
bugs in 
Show quoted textHide quoted text
> > the interrupt entry/exit code that could show up like this.
> > 
> 
> No its winarm with gcc 4.0.
> 
> 
> Best Regards,
> 
> Mukund Deshmukh.
> Beta Computronics Pvt Ltd
> 10/1, IT Park, Parsodi,
> Nagpur-440022
> Cell - 9422113746
>

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.