用的是新唐demo代码,只是把P20改成P24,
Idle正常:
/* Initialize P2.4 */
P2_Init(4);
printf("Enter idle mode...\n");
delay();
Un_Lock_Reg();
PWRCON &= ~PD_WAIT_CPU;
PWRCON &= ~PWR_DOWN_EN;
Lock_Reg();
__WFI();
delay();
printf("Exit from idle mode...\n");
powerdown进不去:
P2_Init(4);
printf("Enter power down mode...\n");
delay();
/* Enter power down mode */
Un_Lock_Reg();
/* Indicate waking from sleep might take longer. */
SCR |= SLEEPDEEP;
/* Disable interrupt occur when Power down mode wakeup */
PWRCON &= ~PD_WU_IE;
/* Power down control */
PWRCON &= ~PD_WAIT_CPU;
PWRCON |= PWR_DOWN_EN;
Lock_Reg();
delay();
printf("WakeUp from power down mode...\n\n"); |