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

PSoC™ 4

Li_Qiang
Level 4
50 replies posted 50 sign-ins 25 replies posted
Level 4

我碰到了一个问题,我使用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 Likes
1 Solution
Li_Qiang
Level 4
50 replies posted 50 sign-ins 25 replies posted
Level 4

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

/* 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();
}

View solution in original post

0 Likes
20 Replies