STM32系统嘀嗒定时器实现1ms中断事件

int main()
{
    
    
	//系统定时器实现周期性1000hz中断事件,即1ms
	SysTick_Config(SystemCoreClock / 1000);
	

}


void SysTick_Handler(void)
{
    
    
	static uint32_t cnt=0;
	cnt++;//记500次之后,=500ms,点灯
	if(cnt >=500)
	{
    
    
		cnt=0;
		灯亮;
	}
}

最大的定时时间:
如果是168MHZ,
2^24 ÷ 168000000=99.86ms

猜你喜欢

转载自blog.csdn.net/ABCisCOOL/article/details/115008903