keil5怎么串口调试?
unsigned int TimingDelay; void delay(time_delay)// { TimingDelay=time_delay; while(TimingDelay != 0); } void TIM2_IRQHandler(void)//中断中计数,每到一次中断-- 具体单位时间 以定时器设置为准 { if(TIM_GetITStatus(TIM2, TIM_IT_Update) == SET) { TIM_ClearFlag(TIM2, TIM_IT_Update)
; if(TimingDelay != 0) TimingDelay--; } } 类似这样写即可实现定时器延时,修改定时器相应配置即可移植,不必考虑for等在不同板子及晶振改变时不准的问题