int main(void) { #ifdef DEBUG debug(); #endif
/* System Clocks Configuration */ RCC_Configuration(); /* NVIC configuration */ NVIC_Configuration();
/* Configure the GPIOs */ GPIO_Configuration(); /* Configure the USART1 */ USART_Configuration(); if(BKP_ReadBackupRegister(BKP_DR1) != 0xA5A5) { /* Backup data register value is not correct or not yet programmed (when the first time the program is executed) */
printf("
RTC not yet configured...."); /* RTC Configuration */ RTC_Configuration();
printf("
RTC configured...."); /* Adjust time by values entred by the user on the hyperterminal */ Time_Adjust();
BKP_WriteBackupRegister(BKP_DR1, 0xA5A5); } else { /* Check if the Power On Reset flag is set */ if(RCC_GetFlagStatus(RCC_FLAG_PORRST) != RESET) { printf("
Power On Reset occurred...."); } /* Check if the Pin Reset flag is set */ else if(RCC_GetFlagStatus(RCC_FLAG_PINRST) != RESET) { printf("
External Reset occurred...."); }
printf("
No need to configure RTC...."); /* Wait for RTC registers synchronization */ RTC_WaitForSynchro();---------------------------------->复位后在这个函数中出不来
/* Enable the RTC Second */ RTC_ITConfig(RTC_IT_SEC, ENABLE); /* Wait until last write operation on RTC registers has finished */ RTC_WaitForLastTask(); }
/* Clear reset flags */ RCC_ClearFlag(); /* Display time in infinte loop */ Time_Show(); } |