Systick实验中,Systick用来定时。来看看程序中什么地方出现过Systick相关的语句。 main.c: /* SysTick end of count event each 1ms with input clock equal to 9MHz (HCLK/8, default) */
SysTick_SetReload(9000);
/* Enable SysTick interrupt */
SysTick_ITConfig(ENABLE);
/*******************************************************************************
* Function Name : Delay
* Description : Inserts a delay time.
* Input : nTime: specifies the delay time length, in milliseconds.
* Output : None
* Return : None
*******************************************************************************/
void Delay(u32 nTime)
{
/* Enable the SysTick Counter */
SysTick_CounterCmd(SysTick_Counter_Enable);
TimingDelay = nTime;
while(TimingDelay != 0);
/* Disable SysTick Counter */
SysTick_CounterCmd(SysTick_Counter_Disable);
/* Clear SysTick Counter */
SysTick_CounterCmd(SysTick_Counter_Clear);
}
/*******************************************************************************
* Function Name : TimingDelay_Decrement
* Description : Decrements the TimingDelay variable.
* Input : None
* Output : TimingDelay
* Return : None
*******************************************************************************/
void TimingDelay_Decrement(void)
{
if (TimingDelay != 0x00)
{
TimingDelay--;
}
}
stm32f10x_it.c:
void SysTickHandler(void)
{
TimingDelay_Decrement();
}
|