现在我是通过端口1中断来操作电机的停止,但是有时候电机会出现跑过头的情况,从感应到脱离感应大概需要200ms时间,中断响应时间会达到那么长吗?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
现在我是通过端口1中断来操作电机的停止,但是有时候电机会出现跑过头的情况,从感应到脱离感应大概需要200ms时间,中断响应时间会达到那么长吗?
采用微动开关,到位则发起中断,停止电机。但是好像会停的不及时,导致电机又远离微动开关了。
PORT_INTERRUPT_FUNCTION(P1_ISR, P1INT_VECTOR)
{
if(P1IFG & (1 << 3))
{
if(VM_STATU_LOCKED())
{
MOTOR_OFF();
}
P1IFG &= ~(1 << 3);
}
P1IF = 0;
}