Falls einer mal vor dem selben Problem steht:
Dieser Code funktioniert...
Code:
/************************************************************/
/* PROJECT NAME: INTERRUPTS */
/* Project: LPC2100 */
/* Engineer: S. Stefanowitsch */
/* Filename: main.c */
/* Language: C */
/* Compiler: Keil ARM V2.00b */
/* Assembler: */
/* */
/************************************************************/
#include <LPC21xx.H>
// olimex LPC-P2129: LED on P0.12 (active low)
#define LED1PIN 12
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 = 0x1FF;
//Reset and interrupt on match
T0MCR = 0x3;
//INitialise the VIC
VICVectAddr4 = (unsigned long) T0IRQ;
VICVectCntl4= 0x24; //Allow This Vector, set is as IRQ Slot 4
VICIntSelect = 0x0; //NO FIQs
VICIntEnable = 0x10;//TIMER 0 on board
//start the timer
T0TCR=0x1;
while(1){}
}
void T0IRQ (void) __irq
{
//TOGGLE LED
if(switcher) {
IOSET0 = 1<<LED1PIN;
switcher = 0;
} else {
IOCLR0 = 1<<LED1PIN;
switcher = 1;
}
//RESART TIMER
T0IR=0x1;
//END ISR "Pseudo Write Operation"
VICVectAddr=0xff;
}
Lesezeichen