Hallo!
Ich versuche auf einem ARM7 Intterupts zu benutzen. Der Timer läuft richtig, nur Interrupts bekomme ich noch nicht... Welche Register hab ich vergessen?
Danke schon einmal!
Code:
#include <LPC21xx.H>
// olimex LPC-P2129: LEDs on P0.12/P0.13 (active low)
#define LED1PIN 12
#define LED2PIN 13
void T0IRQ (void) __irq;
unsigned short switcher = 0;
int main(void)
{
//INIT
// define LED-Pins as outputs
IODIR0 |= 1<<LED1PIN;
// set Bits = LEDs off (active low)
IOSET0 = 1<<LED1PIN;
//Sets peripheral clock = system clock
VPBDIV=0x01;
//initialise timer 0
T0TCR = 0x0;
T0TC = 0x0;
T0PR = 0x0;
T0PC = 0x0;
T0MR0 = 0xFF;
//Reset and interrupt on match
T0MCR = 0x3;
//TELL VIC WHAT TO DO!
VICIntSelect = 0x0; //NO FIQs
VICIntEnable = 0x4; //TIMER 0 on board
//Give the VIC the adress
VICVectAddr0=(unsigned long) T0IRQ;
//start the timer
T0TCR=0x1;
while(1){}
}
void T0IRQ (void) __irq
{
//TOGGLE LED
if(switcher) {
IOSET0 = 0<<LED1PIN;
switcher = 0;
} else {
switcher = 1;
IOSET0 = 1<<LED1PIN;
}
//RESET NECCESSARY TIMER VALUES
T0IR=0x1;
//END ISR
VICVectAddr=0xff;
}
Lesezeichen