Thanks, I mean Watchdog work well only in 2 hours, after that, it can' work well.
void WatchDogStart( uint32 Xms )
{
WDTC = (12000000*Xms)/(1000*4); // Xms=5000, 5s reset
WDWARNINT = 32;
WDMOD = WDEN|WDRESET|WDINT;
WDFEED = 0xAA; /* Feeding sequence */
WDFEED = 0x55;
NVIC_EnableIRQ(WWDT_IRQn);
return;
}
void WatchDogClear( void )
{
__disable_irq();
WDFEED = 0xAA; /* Feeding sequence */
WDFEED = 0x55;
__enable_irq();
return;
}
int main(void)
{
uint32 i = 0;
CGU_Init();
WatchDogStart(5000);
Timer0Initialize();
SetDefaultUart1();
Init_LED();
HC595SendData(0xff);
DelayMS(500);
while(1)
{
for(i=0;i<8;i++)
{
HC595SendData(~(0x1<<i));
DelayMS(500);
}
HC595SendData(0xFF);
//WatchDogClear();
}
return 0;
}
it can reset in 2 hours, after that, it can‘t work well.
Regards,
Haibin Xiao