- void Delay_Init(void)
- {
- SystemCoreClockUpdate();
- }
- void Delay_ms(__IO u32 nms)
- {
- SysTick_Config(SystemCoreClock / 1000);
- cntMs = nms;
- while(cntMs != 0);
- }
- void Delay_us(__IO u32 nus)
- {
- SysTick_Config(SystemCoreClock / 1000000);
- cntUs = nus;
- while(cntUs != 0);
- }
- void SysTick_Handler(void)
- {
- if(cntMs)
- {
- cntMs --;
- }
- if(cntUs)
- {
- cntUs --;
- }
- }
我用Delay_ms函数就好使,用Delay_us函数就会卡住。
请问高手,如何解决?谢谢
|