目前小弟刚接触ARM7处理器,芯片为LPC2103,在用TIMER0实现定时中断时,一直提示有错,小弟的开发环境是IAR,查询方式是OK的,中断方式就是不行啊,求高手指教:
例程代码如下:
void InitTimer0(void)
{
//IRQEnable();
T0TCR = 2;
T0TC = 0;
T0PR = 0;
T0MCR = 0x03;
T0MR0 = 11059200/2;
T0TCR = 0x01;
// Assign to IRQ
VICIntSelect = VICIntSelect&(~(1<<4));
// Set interrupt slots
VICVectAddr0 = (unsigned int)IRQ_Timer0;//Interrupt Vector Enter Address
VICVectCntl0 = 0x20|0x04; //Interrupt Vector Privilege Level
// Timer 0 interrupt enable
VICIntEnable = 1<<0x04;
}
void __irq IRQ_Timer0(void)
{
if((IO0SET&LED1CON)==0)
IO0SET = LED1CON|LED2CON|LED3CON; //LED2端口高电平
else
IO0CLR = LED1CON|LED2CON|LED3CON; //LED2端口低电平
T0IR = 0x01;
VICVectAddr0 = 0;
}
这种写法系统提示:Error[Pa002]: the type attribute "__irq" is not allowed on this declaration ;
我在网上看也有 __irq void IRQ_Timer0(void)写法,这种写法编译是没有问题的;
但进不了中断;
小弟在线等待解答。 |