@far @interrupt void EXTI3_PD_IRQHandler(void) // vector == 6
{
NOP();
NOP();
// PD_CR2 = 0b10000001; // PD1,关闭中断
LED2 = ~LED2;
}
void IWDG_Init(void) // independent WDG
{
IWDG_KR = KEY_ENABLE; // START IWDG
IWDG_KR = KEY_ACCESS;
IWDG_RLR = 0xFF;
IWDG_PR = 0x06; // independent watchdog , prescaler/256 for wdt freq. 1MS
IWDG_KR = KEY_REFRESH;
}
void sleep_proc(void)
{
PD_CR2 = 0b10000011; // PD1 上拉中断输入?
LED3 = LED_ON;
EN_INT();
HALT();
LED3 = LED_OFF;
DIS_INT();
PD_CR2 = 0b10000001; // PD1,上拉输入
NOP();
NOP();
}
void main()
{
mcu_initialize();
for(;;)
{
// CLR_IWDG();
while(KEY == 1)
{
CLR_IWDG();
}
sleep_proc();
}
}
每次外中断唤醒后,又重新复位了,是怎么回事呢?
哪位帮忙分析下呀? |