打印

RTC的例程复位后死循环

[复制链接]
2020|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
LBZZYH|  楼主 | 2008-5-16 10:51 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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();
}
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

5

主题

23

帖子

1

粉丝