剩下几个函数了,但是现歇象依然,程序如下:我只要注释掉// GPIO_WriteHigh(GPIO_V5_CON , V5_CON); 语句,主函数中delay(7)延时就增加19%左右, 真是郁闷,望高人指点.. 附项目工程
void InitPort(void)
{
GPIO_Init(GPIO_V5_CON , V5_CON ,GPIO_MODE_OUT_PP_LOW_SLOW);
GPIO_Init(PORT_TX791 , TX791 ,GPIO_MODE_OUT_PP_LOW_SLOW);
// GPIO_WriteHigh(GPIO_V5_CON , V5_CON);
GPIO_WriteLow(PORT_TX791, TX791);
//System_WDRInit();
}
void main(void)
{
SysClkSet();
InitPort();
sim();//关中断
while(1)
{
GPIO_WriteLow(PORT_TX791, TX791);
delay(7);
GPIO_WriteHigh(PORT_TX791, TX791);
delay(7);
IWDG_ReloadCounter();
}
}
void SysClkSet(void)
{
#if 1
CLK_DeInit();
/* Configure the Fcpu to DIV1*/
CLK_SYSCLKConfig(CLK_PRESCALER_CPUDIV1);
/* Configure the HSI prescaler to the optimal value */
CLK_SYSCLKConfig(CLK_PRESCALER_HSIDIV1);
/* Initilize the CLock controller according to CLK_InitStructure */
CLK_ClockSwitchConfig(CLK_SWITCHMODE_AUTO, CLK_SOURCE_HSE, DISABLE, DISABLE);
CLK_HSECmd(ENABLE);
#endif
}
/**************************************
函数名称:看门狗init
函数功能:
输入参数:
输出参数:
**************************************/
void System_WDRInit(void)
{
#if 0
/* Enable the IWDG*/
IWDG_Enable();
/* Enable the access to the IWDG registers*/
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
/* Fixe IWDG Reset period */
IWDG_SetPrescaler(IWDG_Prescaler_256);//分频
IWDG_SetReload(0xFF);
/* Refresh IWDG */
IWDG_ReloadCounter();
#endif
}
void delay(u16 temp)
//void delay(unsigned int temp)
//void delay(unsigned int temp) //单位140us for 4mhz
{ //把它改到100us
unsigned char i ;
while(temp-->0)
{
for(i=0;i<=80;i++);
}
} |