void Enable_WDT_Reset_Config(void)
{
set_IAPEN;
IAPAL = 0x04;
IAPAH = 0x00;
IAPFD = 0x0F;
IAPCN = 0xE1;
set_CFUEN;
set_IAPGO; //trigger IAP
while((CHPCON&SET_BIT6)==SET_BIT6); //check IAPFF (CHPCON.6)
clr_CFUEN;
clr_IAPEN;
}
void main (void)
{
Set_All_GPIO_Quasi_Mode;
clr_GPIO1;
Timer0_Delay1ms(50); //toggle I/O to show MCU Reset
set_GPIO1;
Timer0_Delay1ms(50);
clr_GPIO1;
Timer0_Delay1ms(50);
set_GPIO1;
Timer0_Delay1ms(50);
//----------------------------------------------------------------------------------------------
// WDT Init !!! ENABLE CONFIG WDT FIRST !!!
// Warning:
// Always check CONFIG WDT enable first, CONFIG not enable, SFR can't enable WDT reset
// Please call Enable_WDT_Reset_Config() function to enable CONFIG WDT reset
//----------------------------------------------------------------------------------------------
Enable_WDT_Reset_Config();
TA=0xAA;TA=0x55;WDCON=0x07; //Setting WDT prescale
set_WDCLR; //Clear WDT timer
while((WDCON|~SET_BIT6)==0xFF); //confirm WDT clear is ok before into power down mode
EA = 1;
set_WDTR; //WDT run
while(1)
{
clr_GPIO1;
Timer0_Delay1ms(500);
set_GPIO1;
Timer0_Delay1ms(500);
clr_GPIO1;
Timer0_Delay1ms(500);
set_GPIO1;
Timer0_Delay1ms(500);
set_PD;
}
}
自从烧了官方例程的看门狗复位程序后,烧其他的程序也会一直复位,请问各位大佬怎么才能解决这个问题啊?
|