求大神指教一下,这个该怎么改啊

2019-07-19 21:40发布

#ifdef _COSMIC_
@far @interrupt void EXTI_PORTD_IRQHandler(void)
#else /* _RAISONANCE_ */
void EXTI_PORTD_IRQHandler(void) interrupt 6
#endif /* _COSMIC_ */
{
  /* In order to detect unexpected events during development,
     it is recommended to set a breakpoint on the following instruction.
  */

u8 State,Trigger;

EXTI_SetExtIntSensitivity(EXTI_PORT_GPIOD, EXTI_SENSITIVITY_RISE_FALL);//hall_mode
State = GPIO_ReadInputData(GPIOD);
Trigger = (u8)(State & 0x1C);//PD2|3|4   现在我要用的是PD3,PC5,PE5三个引脚用来获取霍尔信号

if(Trigger != 0)
{
switch(Trigger)
{
case 0x04:Motor_Step = 1;break;//next->AC
case 0x0c:Motor_Step = 2;break;//next->BC
case 0x08:Motor_Step = 3;break;//next->BA
case 0x18:Motor_Step = 4;break;//next->CA
case 0x10:Motor_Step = 5;break;//next->CB
case 0x14:Motor_Step = 0;break;//next->AB

Commutation(Motor_Step,Duty_Cycle);

}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。