#include "LPC2103.h"
#include "config.h"
#include "stdio.h"
#define LED0 1 <<0
#define LED1 1 << 1
void IRQ_EXTINT0(void);
void EXTINT_Init();
void GPIO_Init();
void main(void)
{
GPIO_Init();
IRQ_EXTINT0();
EXTINT_Init();
while(1)
{}
}
void GPIO_Init()
{
PINSEL0 = 0x00000000;
IODIR = LED0|LED1;
IOSET = LED0;
}
void EXTINT_Init()
{
PINSEL1 = 0x00000001;
EXTMODE &= 1 << 0;
EXTPOLAR &= (1 << 0);
VICIntSelect = (0 << 14);
VICVectAddr0 = (unsigned int)IRQ_EXTINT0;
VICVectCntl0 = 0x20 | 14;
EXTINT = 1 << 0;
VICIntEnable = (1 << 14);
}
void IRQ_EXTINT0(void)
{
//IOCLR = LED0;
while((EXTINT& 0x01) != 0)
{
EXTINT = (1 << 0);
}
IOSET = LED1;
VICVectAddr = 0x00;
} |