PLEASE HELP Cannot find a way to use timer interrupt for lpc2106

Started by vicky gosar October 5, 2005
If anybody out there has an idea or program how to use the timer interrupt with lpc2106 pl................... help

Regards

Vicky ---------------------------------
Yahoo! India Matrimony: Find your partner now.



An Engineer's Guide to the LPC2100 Series

Hello Vicky,

This is a snip of my code for the LPC2129, don't know about
the LPC2106 exactly, but I guess it will be the same or almost the same.

Beside this code you also need to enable the IRQ's if this isn't done in
your startup code already.

Succes,
Aalt
<snip>
#include "LPC21xx.h"

unsigned long timeval;

// declare tc0 as interrupt handler
void isr_tc0 (void) __attribute__ ((interrupt("IRQ")));

//-----
// Setup the Timer Counter 0 and prepare it for IRQ
//-----

void initTimer0 (unsigned long pclk_cycles) {
T0MR0 = pclk_cycles-1; // 'n' cycles needs match 'n-1'
T0PR = 0; // Timer 0 incr on every pclk
T0MCR = 3; // Interrupt and Reset on MR0
T0TCR = 1; // Timer0 Enable

timeval=0; // reset timertick counter

VICIntSelect &= ~(1<<4); // Timer 0 Interrupt is an IRQ
VICVectAddr0 = (unsigned long)isr_tc0; // set interrupt vector in 0
VICVectCntl0 = 0x20 | 4; // use it for Timer 0 Interrupt
VICIntEnable = (1<<4); // Enable Timer0 Interrupt
} //-----
// Timer Counter 0 Interrupt handler
//-----

void isr_tc0 (void) {
timeval++; // increment timertick

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

<end of snip>

vicky gosar wrote:
> If anybody out there has an idea or program how to use the timer
> interrupt with lpc2106 pl................... help
>
> Regards
>
> Vicky > ---------------------------------
> Yahoo! India Matrimony: Find your partner now. > SPONSORED LINKS
> Microprocessor
> <http://groups.yahoo.com/gads?t=ms&k=Microprocessor&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microprocessor&c=4&s&.sig=tsVC-J9hJ5qyXg0WPR0l6g>
> Microcontrollers
> <http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microprocessor&c=4&s&.sig=DvJVNqC_pqRTm8Xq01nxwg>
> Pic microcontrollers
> <http://groups.yahoo.com/gads?t=ms&k=Pic+microcontrollers&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microprocessor&c=4&s&.sig=TpkoX4KofDJ7c6LyBvUqVQ>
>
> 8051 microprocessor
> <http://groups.yahoo.com/gads?t=ms&k51+microprocessor&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microprocessor&c=4&s&.sig=1Ipf1Fjfbd_HVIlekkDP-A >
>
> >. >
>

--
==============================
Aalt Lokhorst
Schut Geometrische Meettechniek bv
Duinkerkenstraat 21
9723 BN Groningen
P.O. Box 5225
9700 GE Groningen
The Netherlands
Tel: +31-50-5877877
Fax: +31-50-5877899
E-mail: Lokhorst@Lokh...
==============================