本帖最后由 zjqlovelyy 于 2014-5-28 20:43 编辑
在程序里面,程序的功能是使得led以1s间隔闪烁,但是实际上这个程序没有进入到定时器的中断里面,调试的时候INTPND和SRCPND相应的位(第10位)已经置位了,INTMSK也清除相应的位了,而且内存中中断向量表timer0的位置也放了中断服务函数的地址。为什么会没有触发中断的?(补充下:我使用的是H-Jtag并口烧写的,到Nor flash中,位于bank0)
#include "2440addr.h"
#include "config.h"
void __irq timer0ISR(void);
void timer0Init(void);
void ledInit(void);
static int ledFlag=1;
void Main(void)
{
ledInit();
timer0Init();
while(1)
{
/* if ( (rSRCPND & (1<<10)) == 1)
{
ledFlag = !ledFlag;
rSRCPND = (1<<10);
}*/
if (ledFlag)
{
rGPBDAT &= ~(1<<5);
}
else
rGPBDAT |= (1<<5);
}
}
void ledInit(void)
{
rGPBCON &= ~(3<<10);
rGPBCON |= (1<<10);
rGPBDAT &= ~(1<<5);
}
void timer0Init(void)
{
pISR_TIMER0 = (unsigned int)timer0ISR;
rSRCPND |= (1<<10);
rINTPND |= (1<<10);
rINTMSK &= ~(1<<10);
rTCFG0 &= ~(0xff);
rTCFG0 |= 99;
rTCFG1 &= ~(0xf);
rTCFG1 |= 2;
rTCNTB0 = 62500;
rTCON &= ~(0xf<<0);
rTCON |= ((1<<0)|(1<<1)|(1<<3));
rTCON &= ~(1<<1);
}
void __irq timer0ISR(void)
{
ledFlag = !ledFlag;
rSRCPND |= (1<<10);
rINTPND |= (1<<10);
}
|