SystickConfiguration(); SystickDelay(10);
void SystickConfiguration(void) { SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8); /* SysTick end of count event each 1ms with input clock equal to 9MHz (HCLK/8, default) */ SysTick_SetReload(9000); SysTick_ITConfig(ENABLE); }
void SystickDelay(int nTime) { /*Enable the SysTick Counter */ SysTick_CounterCmd(SysTick_Counter_Enable); TimingDelay = nTime; while(TimingDelay != 0);
/* Disable SysTick Counter */ SysTick_CounterCmd(SysTick_Counter_Disable); /* Clear SysTick Counter */ SysTick_CounterCmd(SysTick_Counter_Clear); }
在stm32f10x_it.c中填写
void SysTickHandler(void) { if (TimingDelay != 0x00) { TimingDelay--; } }
程序如上,也就是参照了demo里面的程序,
但无法定时,,,不知道还差些什么东西????
香水兄很长时间不理小弟了. |