[其它应用] 配置有问题吗?

[复制链接]
2718|5
 楼主| gongche 发表于 2021-2-5 21:36 | 显示全部楼层 |阅读模式

//-------------------------------------------------------------------------
void init_exint2(void)
{
//P0.6:INT2---input port & pull high
        P0CR &= ~BIT_6;
        P0PCR |= BIT_6;
        
        //IT3=1;//falling edge trig
        //IE0=0;
        //IPH0|=0x01;//PX0H //exint 0 interrupt priority 2
        //priority affect timer3
#if 1        
        IT20=0;
        IT21=1;//rising edge trigger
#else
        IT20=1;
        IT21=0;//falling edge trigger
#endif
        IE2=0;
//--interrupt priority
        //IPL1|=BIT_1;
        //IPH1|=BIT_1;
        
        IEN1|=BIT_1;//enable external interrupt 2
}

//-------------------------------------------------------------------------

void exint2(void) interrupt 8  //IR
{

}

中断2死活进不去
huanghuac 发表于 2021-2-5 21:38 | 显示全部楼层
没看出来
 楼主| gongche 发表于 2021-2-5 21:40 | 显示全部楼层
我再琢磨琢磨吧,多谢了哈
麻花油条 发表于 2024-9-27 10:52 | 显示全部楼层
P0.6要被正确配置为外部中断源。
laocuo1142 发表于 2024-9-27 10:52 | 显示全部楼层
您的代码中注释掉了设置中断优先级的部分。在某些系统中,如果中断优先级设置不正确,可能会导致中断不被处理。您可以尝试取消注释并设置适当的优先级。
flycamelaaa 发表于 2024-9-27 11:00 | 显示全部楼层
您的中断服务例程exint2是空的。在调试时,您可以在其中添加一些代码(如LED翻转或串口输出)来确认中断确实被触发和执行。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

768

主题

9410

帖子

2

粉丝
快速回复 在线客服 返回列表 返回顶部