Yahoo Groups archive

Lpc2000

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

Message

Re: Timer Interrupt on Crossworks

2005-11-10 by mhaines4102

Well this is what I have now and it is working:
	/* Timer 0 interrupt is an IRQ interrupt */
	VICIntSelect &= ~(0x10);
	/* Enable timer 0 interrupt */
	VICIntEnable = (0x10);
	/* Clear a selected interrupt. 0s should do nothing. */
	VICIntEnClr = 0x0000;
	/* Use slot 0 for timer 0 interrupt */
	VICVectCntl0 = 0x24;
	/* Clear a previous interrupt call */
	VICVectAddr = 0x0;
	/* Set the address of ISR for slot 0 */
	VICVectAddr0 = (unsigned long)timer0ISR;

	/* Reset timer 0 */
	T0TCR = 0;
	/* Set the timer 0 prescale counter */
	T0PR = 2500;
	/* Set timer 0 match register */
	T0MR0 = 1000;
	/* Generate interrupt and reset counter on match */
	T0MCR = 3;
	/* Start timer 0 */
	T0TCR = 0x01;
	T0IR = 0xFF;

I just went through the book and made sure anything that could be
reset, was.

Thanks,

Mike Haines


--- In lpc2000@yahoogroups.com, "Karl Olsen" <kro@p...> wrote:
>
> ---- Original Message ----
> From: "mhaines4102" <mhaines4102@y...>
> To: <lpc2000@yahoogroups.com>
> Sent: Thursday, November 10, 2005 9:40 PM
> Subject: [lpc2000] Timer Interrupt on Crossworks
> 
> > I have a dumb question. I am embarrassed to ask but... I am using a
> > timer interrupt. My setup is as follows:
> > /* Timer 0 interrupt is an IRQ interrupt */
> > VICIntSelect &= ~(0x10);
> > /* Enable timer 0 interrupt */
> > VICIntEnable = (0x10);
> > /* Use slot 0 for timer 0 interrupt */
> > VICVectCntl0 = 0x24;
> > /* Set the address of ISR for slot 0 */
> > VICVectAddr0 = (unsigned long)timer0ISR;
> > /* Reset timer 0 */
> > T0TCR = 0;
> > /* Set the timer 0 prescale counter */
> > T0PR = 2500;
> > /* Set timer 0 match register */
> > T0MR0 = 1000;
> > /* Generate interrupt and reset counter on match */
> > T0MCR = 3;
> > /* Start timer 0 */
> > T0TCR = 0x01;
> > T0IR = 0xFF;
> > 
> > The interrupt was being called, then it stopped. I changed some
> > settings and it came back, then it stopped again. I added T0IR = 0xFF;
> > to the end of the setup and it worked, then it stopped again. What
> > have I missed? I am beginning to feel like a goof.
> 
> Have you remembered a
>    VICVectAddr = 0x00;  /* Clear interrupt flag in the VIC */
> and a
>    T0IR = 0x01  /* Clear the match 0 interrupt flag */
> in your interrupt handler?
> 
> Karl Olsen
>

Attachments

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.