|
为什么LPC2103 ARM的IRQ中断无法使用
[复制链接]
这是我写的timer1定时器IRQ中断程序:当定时器发生中断时,关闭LED
我用的开发工具是IAR Embedded Workbench(编译成ARM指令,不用THUMB指令)
#include
#define Fosc 11059200
#define Fcclk (Fosc * 4)
#define Fcco (Fcclk * 4)
#define Fpclk (Fcclk / 4) * 1
__irq __arm void Timer1_ISR(void)
{
IOSET = 0x00180000;
T1IR=0xff;
VICVectAddr = 0;
}
void Timer1Init(void)
{
T1TC = 0;
T1PR = 0;
T1MR2 = Fpclk / 10;
T1MCR = 0x40; //MR2匹配时复产生中断
T1IR=0xff;
VICIntSelect = 0; //置为IRQ中断
VICVectCntl0 = 0x25;
VICVectAddr0 = (unsigned int) Timer1_ISR;
VICIntEnable = (1 << VIC_TIMER1);
T1TCR = 0x01;
}
int main()
{
/* 初始化VIC */
VICIntEnClear = 0xffffffff;
VICVectAddr = 0;
VICIntSelect = 0;
PINSEL1 = 0xFFFFFCBF;
IODIR = 0x000180000;
IOCLR = 0x00180000;
Timer1Init();
return 0;
}
试验了很多次也不成功,不知哪里有问题,
寄存器赋值及管脚输出没问题,希望好心人看一下,谢了。
|
|