PSoC4中断异常触发

公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

Tip / 登入 to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Lin_Qiang
Level 4
Level 4
5 likes given First like given 50 replies posted

我碰到了一个问题,我使用PSoC4的管脚下降沿触发中断(硬件电路是小于4.5V管脚会变低),使用电源变动测试的时候,反复调整电压从9V→0V→9V,在第一次变为0V的时候我使用生成的stop函数关闭了中断,电源变动结束恢复到9V后我使用生成start函数开启中断时,会立即触发一次中断,这时候管脚状态并不是低电平,这是为什么?

配置是下面这样的,自动生成的函数是B_DET_Low_ShutDown_Stop和B_DET_Low_ShutDown_Start。

Li_Qiang_0-1643362510947.png

Li_Qiang_1-1643362540824.png

Li_Qiang_2-1643362563780.png

 

 

0 点赞
1 解答
Lin_Qiang
Level 4
Level 4
5 likes given First like given 50 replies posted

这个问题在中断使能之前通过追加下列代码,已经解决了。

/* Loop to verify if pending interrupt on pin is cleared */
while((B_DET_Low_INTSTAT & B_DET_Low_MASK) == B_DET_Low_MASK)
{
/* Try to clear the interrupt on Pin_INTSTAT */
B_DET_Low_ClearInterrupt();

/* Clear Pending on ISR component as well */
B_DET_Low_ShutDown_ClearPending();
}

在原帖中查看解决方案

0 点赞
20 回复数