Interrupted Vacation
Well, I didn't spend all my vacation time on the beach. I spent a little time pouring over the LPC user manual and hacking the Timer Interrupt example that I mentioned earlier here to make it initialize the VIC and take interrupts from EINT0 connected to pin 1. Here is where I got to:
// Tell the Pin Function Select Register that EINT0 is
// on pin 1
PINSEL0 = PINSEL0 | (3 << 2);
// Set interrupt vector in slot 0 to be the "pressed"
// IRQ function
VICVectAddr0 = (unsigned long)pressed;
// Note: slot 0 is the highest priority slot in the VIC
// table so assigning it to a button isn't entirely
// sensible but will suffice for this example.
// Default ISR for non vectored interrupts that can occur
VICDefVectAddr = (unsigned long) DefISR;
// EINT0 contributes to IRQ
VICIntSelect &= ~0x4000;
// This keeps things clean in case this code is used
// when other interrupts are contributing to IRQ or FIQ
// use it for EXINT0 and turn it on
VICVectCntl0 = 0x20 | 14;
// Enable this interrupt
VICIntEnable = VICIntEnable | 0x4000;
So all looks good. I'll try putting it all together tomorrow.



0 Comments:
Post a Comment
<< Home