注册 登录
电子工程世界-论坛 返回首页 EEWORLD首页 频道 EE大学堂 下载中心 Datasheet 专题
jomin的个人空间 https://home.eeworld.com.cn/space-uid-212061.html [收藏] [复制] [分享] [RSS]
日志

lm3s 把中断放在ram中,对NVIC_VTABLE赋值时错误

已有 954 次阅读2012-7-13 15:06

[code]void
IntRegister(unsigned long ulInterrupt, void (*pfnHandler)(void))
{
unsigned long ulIdx, ulValue;

//
// Check the arguments.
//
ASSERT(ulInterrupt < NUM_INTERRUPTS);
// Make sure that the RAM vector table is correctly aligned.
//
ASSERT(((unsigned long)g_pfnRAMVectors & 0x000003ff) == 0);

//
// See if the RAM vector table has been initialized.
//
if(HWREG(NVIC_VTABLE) != (unsigned long)g_pfnRAMVectors)
{
// Copy the vector table from the beginning of FLASH to the RAM vector
// table.
//
ulValue = HWREG(NVIC_VTABLE);
for(ulIdx = 0; ulIdx < NUM_INTERRUPTS; ulIdx++)
{
g_pfnRAMVectors[ulIdx] = (void (*)(void))HWREG((ulIdx * 4) +
ulValue);
}

//
// Point NVIC at the RAM vector table.
//

HWREG(NVIC_VTABLE) = (unsigned long )(g_pfnRAMVectors+8);
}
// Save the interrupt handler.
g_pfnRAMVectors[ulInterrupt] = pfnHandler;
}[/code]
上面是函数 那个+8是我自己加上的,加和不加都一样,NVIC_VTABLE始终是20000380.
为什么
评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

热门文章