试试这样
void TIM3_IRQHandler(void)
{
if(TIM_GetITStatus(TIM3,TIM_IT_Update)!=RESET)
{
if(CurrentStu == STOP)
{
GPIOA->BRR = (0x0001<<12);//GPIO_ResetBits(GPIOA,GPIO_Pin_12);//GPIOA12 reset
CurrentStu = RUN;
}
else if(CurrentStu == RUN)
{
GPIOA->BSRR = (0x0001<<12); //GPIO_SetBits(GPIOA,GPIO_Pin_12);//GPIOA12 set
CurrentStu = STOP;
}
__nop();__nop();__nop();__nop();__nop();
TIM_ClearITPendingBit(TIM3,TIM_IT_Update);
}
} |