The system tick timer is an important part of the Cortex-M3 . The system tick timer is designed to provide 10 millisecond interval interrupts for the operating system or other system management software . Because the system tick timer is part of the Cortex-M3 , it is easy to port software by providing a standard timer that can be used in Cortex-M3 core devices .
/************************************************************************
** 函数名:void SysTick_Init(uint8_t time)
** 函数功能: systick初始化
** 输入参数: time 定时时间(ms)
** 输出参数: 无
** 返回值:无
************************************************************************/
void SysTick_Init(uint8_t time){
SysTick_Config(SystemCoreClock/1000*time); //系统时钟/1000
}
/************************************************************************
** 函数名:void delay_us(uint32_t MS)
** 函数功能: 毫秒延时函数
** 输入参数: 毫秒
** 输出参数: 无
** 返回值:无
************************************************************************/
void Delay_ms(uint32_t MS){
unsigned long systickcnt;
systickcnt = SysTickCnt;
while ((SysTickCnt - systickcnt) < MS);
}
void SysTick_Handler(void)
{
SysTickCnt++;
SysTick->CTRL &= ~(1<<16);
}
【11】LPC1768_SYSTICK实验.rar
(251.73 KB, downloads: 9)
This content is originally created by EEWORLD forum user cxmdz . If you want to reprint or use it for commercial purposes, you must obtain the author’s consent and indicate the source