SysTick時(shí)鐘為HCKL的8分頻,故如果HCLK時(shí)鐘為72MHz,SysTick->LOAD的值為7200的話,則SysTick 1ms中斷 一次。如果屏蔽全局中斷的話,則STSTICK不能這用。
---------------------------------------------------------------------------------------------------- 例: //SysTick 配置 if (SysTick_Config(SystemFrequency / 1000))// (72MHz/1000)*SYSCLK=1MS {
while (1); } ---------------------------------------------------------------------------------------------------- 本文引用地址:http://m.butianyuan.cn/article/201611/321610.htm//具體應(yīng)用 volatile u16 Timer1; void SysTickDelay(u16 dly_ms) { Timer1=dly_ms; while(Timer1); } ---------------------------------------------------------------------------------------------------- 中斷函數(shù)
void SysTick_Handler(void) { if(Timer1) Timer1--; } |
評(píng)論