keil5怎么串口調(diào)試?
unsigned int TimingDelay; void delay(time_delay)// { TimingDelay=time_delay; while(TimingDelay != 0); } void TIM2_IRQHandler(void)//中斷中計(jì)數(shù),每到一次中斷-- 具體單位時(shí)間 以定時(shí)器設(shè)置為準(zhǔn) { if(TIM_GetITStatus(TIM2, TIM_IT_Update) == SET) { TIM_ClearFlag(TIM2, TIM_IT_Update)
; if(TimingDelay != 0) TimingDelay--; } } 類似這樣寫即可實(shí)現(xiàn)定時(shí)器延時(shí),修改定時(shí)器相應(yīng)配置即可移植,不必考慮for等在不同板子及晶振改變時(shí)不準(zhǔn)的問題