Reply by Ankur Khetrapal January 2, 20072007-01-02
thats right.. i think the confusion was __irq keyword maybe is used with
armc and not gcc

--
Anks

On 1/2/07, Andrew Berney wrote:
>
> I think what you're looking for is actually:
>
> void timer_init(void)
> {
> T0PR = 0x0; // set the prescaler to the pclk frequency
> T0TCR = 0x2; // reset the counter to 0
> T0MCR = 0x3; // on match generate an IRQ and reset counter
> T0MR0 = 1577; // count 1578 cycles per IRQ
> T0TCR = 0x1; // enable timer
>
> VICVectAddr0 = (unsigned)TMR0ISR; // address of IRQ handler
> VICVectCntl0 = 0x20 | 4; // IRQ 4 + Enabled bit
> VICIntEnable |= 0x10; // Turn on IRQ 4
> }
>
> Andy
>
> -----Original Message-----
> From: l... [mailto:
> l... ]On Behalf Of
> Ankur Khetrapal
> Sent: 31 December 2006 01:13
> To: l...
> Subject: [lpc2000] timer interrupts
>
> Hi
>
> I am using gnuarm compiler with keil.
>
> I need to run a timer interrupt after a specific time interval again and
> again. I initiate the timer to generate the interrupt.
>
> void timer_init(void)
> {
> T0MR0 = 1577;
> T0MCR = 1; // Interrupt and Reset on MR0
> -- check -- should be MR1
> T0TCR = 1; // Timer0 Enable
>
> VICVectAddr0 = (unsigned long)TMR0ISR; //timer0isr vector address
> VICVectCntl0 = 0x20 | 4;
> VICIntEnable = 0x00000010; //enable interrupt
> }
>
> void TMR0ISR(void)
> {
>
> // code here
>
> T0IR = 1; // Clear interrupt flag
> VICVectAddr = 0; // Acknowledge Interrupt
> }
>
> When i debug the above code.. the timer interrupt is run the first time.
> but
> not after that that. What do i need to change so that the timer interrupt
> is
> called again and again.
>
> thankz
>
> Ankz
>
>
>
>
>

An Engineer's Guide to the LPC2100 Series

Reply by Andrew Berney January 2, 20072007-01-02
I think what you're looking for is actually:

void timer_init(void)
{
T0PR = 0x0; // set the prescaler to the pclk frequency
T0TCR = 0x2; // reset the counter to 0
T0MCR = 0x3; // on match generate an IRQ and reset counter
T0MR0 = 1577; // count 1578 cycles per IRQ
T0TCR = 0x1; // enable timer

VICVectAddr0 = (unsigned)TMR0ISR; // address of IRQ handler
VICVectCntl0 = 0x20 | 4; // IRQ 4 + Enabled bit
VICIntEnable |= 0x10; // Turn on IRQ 4
}

Andy

-----Original Message-----
From: l... [mailto:l...]On Behalf Of
Ankur Khetrapal
Sent: 31 December 2006 01:13
To: l...
Subject: [lpc2000] timer interrupts
Hi

I am using gnuarm compiler with keil.

I need to run a timer interrupt after a specific time interval again and
again. I initiate the timer to generate the interrupt.

void timer_init(void)
{
T0MR0 = 1577;
T0MCR = 1; // Interrupt and Reset on MR0
-- check -- should be MR1
T0TCR = 1; // Timer0 Enable

VICVectAddr0 = (unsigned long)TMR0ISR; //timer0isr vector address
VICVectCntl0 = 0x20 | 4;
VICIntEnable = 0x00000010; //enable interrupt
}

void TMR0ISR(void)
{

// code here

T0IR = 1; // Clear interrupt flag
VICVectAddr = 0; // Acknowledge Interrupt
}

When i debug the above code.. the timer interrupt is run the first time.
but
not after that that. What do i need to change so that the timer interrupt
is
called again and again.

thankz

Ankz
Reply by Ankur Khetrapal December 31, 20062006-12-31
*

Table 160: Match Control Register (MCR: TIMER0 - T0MCR: 0xE0004014; TIMER1 -
T1MCR: 0xE0008014) *
*

MCR *
*

Function *
*

Description *
*

Reset Value *

0

Interrupt on MR0

When one, an interrupt is generated when MR0 matches the value in the TC.
When zero this interrupt is disabled.

0

1

Reset on MR0

When one, the TC will be reset if MR0 matches it. When zero this feature is
disabled.

0

2

Stop on MR0

When one, the TC and PC will be stopped and TCR[0] will be set to 0 if MR0
matches the TC. When zero this feature is disabled.

0
isnt T0MCR is set for interrupt and reset.. what's wrong???

--

On 12/31/06, Karl Olsen wrote:
>
> ---- Original Message ----
> From: "Ankur Khetrapal" >
> To: >
> Sent: Sunday, December 31, 2006 2:13 AM
> Subject: [lpc2000] timer interrupts
>
> > I am using gnuarm compiler with keil.
> >
> > I need to run a timer interrupt after a specific time interval again
> > and again. I initiate the timer to generate the interrupt.
> >
> >
> > void timer_init(void)
> > {
> > T0MR0 = 1577;
> > T0MCR = 1; // Interrupt and Reset
> > on MR0 -- check -- should be MR1
> > T0TCR = 1; // Timer0 Enable
> >
> > VICVectAddr0 = (unsigned long)TMR0ISR; //timer0isr vector address
> > VICVectCntl0 = 0x20 | 4;
> > VICIntEnable = 0x00000010; //enable interrupt
> > }
> >
> >
> >
> > void TMR0ISR(void)
> > {
> >
> > // code here
> >
> > T0IR = 1; // Clear interrupt flag
> > VICVectAddr = 0; // Acknowledge Interrupt
> > }
> >
> >
> >
> > When i debug the above code.. the timer interrupt is run the first
> > time. but not after that that. What do i need to change so that the
> > timer interrupt is called again and again.
>
> The T0MCR line does not do what the comment says.
>
> Karl Olsen
>
Reply by Ankur Khetrapal December 31, 20062006-12-31
done.. thanx

On 12/31/06, Ankur Khetrapal wrote:
>
> *
>
> Table 160: Match Control Register (MCR: TIMER0 - T0MCR: 0xE0004014; TIMER1
> - T1MCR: 0xE0008014)
> * *
>
> MCR
> * *
>
> Function
> * *
>
> Description
> * *
>
> Reset Value
> *
>
> 0
>
> Interrupt on MR0
>
> When one, an interrupt is generated when MR0 matches the value in the TC.
> When zero this interrupt is disabled.
>
> 0
>
> 1
>
> Reset on MR0
>
> When one, the TC will be reset if MR0 matches it. When zero this feature
> is disabled.
>
> 0
>
> 2
>
> Stop on MR0
>
> When one, the TC and PC will be stopped and TCR[0] will be set to 0 if MR0
> matches the TC. When zero this feature is disabled.
>
> 0
> isnt T0MCR is set for interrupt and reset.. what's wrong???
>
> --
>
> On 12/31/06, Karl Olsen wrote:
> >
> > ---- Original Message ----
> > From: "Ankur Khetrapal" < a...@gmail.com >
> > To: >
> > Sent: Sunday, December 31, 2006 2:13 AM
> > Subject: [lpc2000] timer interrupts
> >
> > > I am using gnuarm compiler with keil.
> > >
> > > I need to run a timer interrupt after a specific time interval again
> > > and again. I initiate the timer to generate the interrupt.
> > >
> > >
> > > void timer_init(void)
> > > {
> > > T0MR0 = 1577;
> > > T0MCR = 1; // Interrupt and Reset
> > > on MR0 -- check -- should be MR1
> > > T0TCR = 1; // Timer0 Enable
> > >
> > > VICVectAddr0 = (unsigned long)TMR0ISR; //timer0isr vector address
> > > VICVectCntl0 = 0x20 | 4;
> > > VICIntEnable = 0x00000010; //enable interrupt
> > > }
> > >
> > >
> > >
> > > void TMR0ISR(void)
> > > {
> > >
> > > // code here
> > >
> > > T0IR = 1; // Clear interrupt flag
> > > VICVectAddr = 0; // Acknowledge Interrupt
> > > }
> > >
> > >
> > >
> > > When i debug the above code.. the timer interrupt is run the first
> > > time. but not after that that. What do i need to change so that the
> > > timer interrupt is called again and again.
> >
> > The T0MCR line does not do what the comment says.
> >
> > Karl Olsen
> >
> >
> >
Reply by Karl Olsen December 30, 20062006-12-30
---- Original Message ----
From: "Ankur Khetrapal"
To:
Sent: Sunday, December 31, 2006 2:13 AM
Subject: [lpc2000] timer interrupts

> I am using gnuarm compiler with keil.
>
> I need to run a timer interrupt after a specific time interval again
> and again. I initiate the timer to generate the interrupt.
> void timer_init(void)
> {
> T0MR0 = 1577;
> T0MCR = 1; // Interrupt and Reset
> on MR0 -- check -- should be MR1
> T0TCR = 1; // Timer0 Enable
>
> VICVectAddr0 = (unsigned long)TMR0ISR; //timer0isr vector address
> VICVectCntl0 = 0x20 | 4;
> VICIntEnable = 0x00000010; //enable interrupt
> }
>
> void TMR0ISR(void)
> {
>
> // code here
>
> T0IR = 1; // Clear interrupt flag
> VICVectAddr = 0; // Acknowledge Interrupt
> }
>
> When i debug the above code.. the timer interrupt is run the first
> time. but not after that that. What do i need to change so that the
> timer interrupt is called again and again.

The T0MCR line does not do what the comment says.

Karl Olsen
Reply by Ankur Khetrapal December 30, 20062006-12-30
Hi

I am using gnuarm compiler with keil.

I need to run a timer interrupt after a specific time interval again and
again. I initiate the timer to generate the interrupt.
void timer_init(void)
{
T0MR0 = 1577;
T0MCR = 1; // Interrupt and Reset on MR0
-- check -- should be MR1
T0TCR = 1; // Timer0 Enable

VICVectAddr0 = (unsigned long)TMR0ISR; //timer0isr vector address
VICVectCntl0 = 0x20 | 4;
VICIntEnable = 0x00000010; //enable interrupt
}

void TMR0ISR(void)
{

// code here

T0IR = 1; // Clear interrupt flag
VICVectAddr = 0; // Acknowledge Interrupt
}

When i debug the above code.. the timer interrupt is run the first time. but
not after that that. What do i need to change so that the timer interrupt is
called again and again.

thankz

Ankz