本帖最后由 le062 于 2011-4-3 17:12 编辑
如下一段代码static __IO uint32_t TimingDelay;
void Delay(__IO uint32_t nTime);
void TimingDelay_Decrement(void);
int main(void)
{
//初始化略去
/* Setup SysTick Timer for 1 msec interrupts */
if (SysTick_Config(SystemFrequency / 1000))
{
/* Capture error */
while (1);
}
while (1)
{
GPIO_SetBits(GPIOC, GPIO_Pin_6);
Delay(500); //ms
GPIO_ResetBits(GPIOC, GPIO_Pin_6);
Delay(500);
}
}
void TimingDelay_Decrement(void)
{
if (TimingDelay != 0x00)
{
TimingDelay--;
}
}
void Delay(__IO uint32_t nTime)
{
TimingDelay = nTime;
while(TimingDelay != 0);
}
为什么TimingDelay能被自减,用keil仿真就死在void Delay()里了
下载下去运行就没问题
搞不懂
找到了
void SysTick_Handler(void)
{
TimingDelay_Decrement();
}
|