while(1){
if((systickTime%1000)==0x00)
{
if(GPIO_ReadOutputDataBit(LEDPORT,LEDPIN) == 0) LED_OFF;
else LED_ON;
if((systickTime%1000)==0x00)
{
if(GPIO_ReadOutputDataBit(LEDPORT,LEDPIN) == 0) LED_OFF;
else LED_ON;
}
}
看似没有bug,细想一下就可以看出来了。while循环里面执行一次需要的时间根本达不到1ms,所以在systickTime还没变化之前就已经执行while循环很多次了。
解决办法:
在while循环里面的添加延时程序,让他大于1ms