void Init_SysTickTimer(void)
{
SysTick->CTRL |= (1<<2); //选择CPU时钟为系统节拍时钟
//SysTick->LOAD = (CCLK/1000)*100 - 1; //100ms
SysTick->LOAD = SysTick->CALIB & 0xFFFFF;
//Enable System Tick interrupt
SysTick->CTRL |= (1<<1);
//Enable System Tick counter
SysTick->CTRL |= (1<<0);
}
void SysTick_Handler(void)
{
//Clear System Tick counter flag
SysTick->CTRL &= ~(1<<16);
//toggle P2.1
LPC_GPIO2->FIOPIN ^= (1<<1);
}
我们要知道SysTick定时器并不是标准外设,它是属于CoreCM3内核,所以当我们想找到它就需要按照上图的路径去寻找~