Hello, I am learning ARM processor using Keil uVision4 and simulating in proteus a LPC2138. I tried to make interrupt with timer0, the only result is the match pin toggling, but never enters inside the ISR. Please, can any body tell me what is wrong or mising?
#include <lpc21xx.h> //global variables unsigned long cont = 0; void wait (void) { /* wait function */ long d; for (d = 0; d < 10000; d++); /* only to delay for LED flashes */ } void TIMER0_ISR(void) __irq { cont++; cont &= 0x0ff; IO1CLR = 0x00ff0000; IO1SET = cont<<16; T0IR |= 0x00000001; //Clear match 0 interrupt VICVectAddr = 0x00000000; //Dummy write to signal end of interrupt } #pragma ARM int main (void) { IODIR1 = 0x00FF0000; // P1.16..23 defined as Outputs PINSEL0 |= 0x20000000; //EINT1 en p0.14 PINSEL0 |= 0x00000800; //MAT0.1 en p0.5 PINSEL0 |= 0x00000080; //MAT0.0 en p0.3 //timers VPBDIV = 0x00000001; // Configure the VPB divi T0PR = 0x000003e8; //Load prescaler = 1000 T0TCR = 0x00000002; //Reset counter and prescaler T0MCR = 0x00000003; //On match reset the counter and generate an interrupt T0MR0 = 0x000003e8; //match register = 1000 T0EMR = 0x00000032; //complementa MAT0 y MAT1 T0TCR = 0x00000001; //enable timer VICVectAddr0 = (unsigned long)TIMER0_ISR; /* Set Interrupt Vector in 0 */ VICVectCntl0 = 0x20 | 0x04; /* Use it for Timer0 Interrupt */ VICIntEnable |=0x00000010; //habilitacion while (1) {} }
Edit Post Reply Reply With Quote Multi-Quote Msg Report Post View Profile Private Message