在线时间12 小时
UID2104060
注册时间2014-6-27
NXP金币0
该用户从未签到
中级会员
 
- 积分
- 378
- 最后登录
- 1970-1-1
|
//==============以下是XGATE 的初始化
#define PORTPISR_VEC 0x8E //想要使用P口的外部中断
static void SetupXGATE(void) {
/* initialize the XGATE vector block and
set the XGVBR register to its start address */
XGVBR= (unsigned int)(void*__far)(XGATE_VectorTable - XGATE_VECTOR_OFFSET);
/* switch software trigger 0 interrupt to XGATE */
ROUTE_INTERRUPT(PORTPISR_VEC, 0x81); /* RQST=1 and PRIO=1 */
/* when changing your derivative to non-core3 one please remove next five lines */
XGISPSEL= 1;
XGISP31= (unsigned int)(void*__far)(XGATE_STACK_L + 1);
XGISPSEL= 2;
XGISP74= (unsigned int)(void*__far)(XGATE_STACK_H + 1);
XGISPSEL= 0;
/* enable XGATE mode and interrupts */
XGMCTL= 0xFBC1; /* XGE | XGFRZ | XGIE */
/* force execution of software trigger 0 handler */
//XGSWT= 0x0101;
}
设置之后在xgate.cxgate里边加入中断服务子程序
interrupt void portp_isr(MyDataType* __restrict pData) {
PIFP_PIFP0 = 1 ; //清除中断标志位
PORTB = 0xf0 ;
}
改变中断向量表
{(XGATE_Function)portp_isr, (int)&MyData}, // Channel 47 - Port P Interrupt
结果程序在不给P0口加脉冲时正常执行主程序,在给P0口加脉冲,使用XGATE时 死掉了,求大神帮助!!!!
|
|