<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > STM32 RTC測試成功 _只顯示 時分秒

          STM32 RTC測試成功 _只顯示 時分秒

          作者: 時間:2016-11-13 來源:網(wǎng)絡 收藏

          源文件位置 STM32F10x_StdPeriph_Lib_V3.1.2ProjectSTM32F10x_StdPeriph_ExamplesRTCCalendar

          本文引用地址:http://www.ex-cimer.com/article/201611/316401.htm

          仔細閱讀其中的readme
          摘抄如下
          @par How to use it ?
          In order to make the program work, you must do the following :
          - Create a project and setup all project configuration
          - Add the required Library files :
          - stm32f10x_gpio.c
          - stm32f10x_rcc.c
          - stm32f10x_rtc.c
          - stm32f10x_bkp.c
          - stm32f10x_pwr.c
          - misc.c
          - stm32f10x_usart.c
          - stm32f10x_exti.c
          - system_stm32f10x.c (under LibrariesCMSISCoreCM3)
          - stm32_eval.c (under UtilitiesSTM32_EVAL)
          - Edit stm32f10x.h file to select the device you are working on.
          - Edit stm32_eval.h file to select the evaluation board you will use.

          根據(jù)之前的經驗 建立工程

          options中建議選上 use microLIB



          現(xiàn)在的時間,睡覺啦

          程序地址

          RTC測試成功
          轉自Tony嵌入式論壇,地址:http://www.cevx.com/bbs/thread-26329-1-1.html

          =========================================================

          關鍵代碼分析

          /**
          * @brief Returns the time entered by user, using Hyperterminal.
          * @param None
          * @retval Current time RTC counter value
          */
          uint32_t Time_Regulate(void)
          {
          uint32_t Tmp_HH = 0xFF, Tmp_MM = 0xFF, Tmp_SS = 0xFF;

          printf("rn==============Time Settings=====================================");
          printf("rn Please Set Hours");

          while (Tmp_HH == 0xFF)
          {
          Tmp_HH = USART_Scanf(23);//若超級終端輸入的數(shù)據(jù)大于23,超級終端提示出錯
          }
          printf(": %d", Tmp_HH);
          printf("rn Please Set Minutes");
          while (Tmp_MM == 0xFF)
          {
          Tmp_MM = USART_Scanf(59);
          }
          printf(": %d", Tmp_MM);
          printf("rn Please Set Seconds");
          while (Tmp_SS == 0xFF)
          {
          Tmp_SS = USART_Scanf(59);
          }
          printf(": %d", Tmp_SS);

          /* Return the value to store in RTC counter register */
          return((Tmp_HH*3600 + Tmp_MM*60 + Tmp_SS));
          }

          --------------------------------------

          /**
          * @brief Displays the current time.
          * @param TimeVar: RTC counter value.
          * @retval None
          */
          void Time_Display(uint32_t TimeVar)
          {
          uint32_t THH = 0, TMM = 0, TSS = 0;

          /* Compute hours */
          THH = TimeVar / 3600;
          /* Compute minutes */
          TMM = (TimeVar % 3600) / 60;
          /* Compute seconds */
          TSS = (TimeVar % 3600) % 60;

          printf("Time: %0.2d:%0.2d:%0.2dr", THH, TMM, TSS);//r回車,光標移到本行首
          }



          關鍵詞: STM32RTC測試時分

          評論


          技術專區(qū)

          關閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();