我把你这个加到外部中断里面,比在定时器里好一点,但也会出现按键失灵
[mw_shl_code=c,true]extern u16 ucTimer_led;
//外部中断0服务程序
void EXTI0_IRQHandler(void)
{
if(WK_UP==1)
{
TIM_Cmd(TIM3,ENABLE);
ucTimer_led++;
if(ucTimer_led > 500)
{
ucTimer_led= 500;
}
}
else
{
if(ucTimer_led > 200 && ucTimer_led < 400) //3s< ucTimer_led < 4s
{
handle_Led(ON,1);
}
else if(ucTimer_led <100 && ucTimer_led >5)//0.5s< ucTimer_led <1s
{
handle_Led(ON,6);
}
ucTimer_led = 0;
}
EXTI_ClearITPendingBit(EXTI_Line0);
}[/mw_shl_code]
2018-10-15 12:43 上传
点击文件名下载附件
4.71 MB, 下载次数: 19