<tfoot id="ygvxt"><menuitem id="ygvxt"></menuitem></tfoot>
    • <kbd id="ygvxt"></kbd>
      <th id="ygvxt"><progress id="ygvxt"></progress></th>

      您好,歡迎訪問上海意泓電子科技有限責(zé)任公司網(wǎng)站!
      4新聞資訊
      您的位置: 首頁 ->  新聞資訊 -> 單片機

      ?STM32F030 WWDG使用結(jié)論

      文章出處:單片機 責(zé)任編輯:上海意泓電子科技有限責(zé)任公司 發(fā)表時間:
      2020
      11-10

      使用STM32F030的WWDG,發(fā)現(xiàn)其在STOP下面跟STM8S的休眠模式的情況一樣,不會對MCU進行復(fù)位.

      貼上看門狗代碼:

      /*************************************************************************************** 

      **************************************************************************************** 

      * FILE      : wdog_drv.c 

      * Description   :  

      *              

      * Copyright (c) 2015 by LAN. All Rights Reserved. 

      *  

      * History: 

      * Version       Name            Date            Description 

         0.1      藍曙光 2015/01/28  Initial Version 

          

      **************************************************************************************** 

      ****************************************************************************************/  

        

      #include "wdog_drv.h"  

        

      #define WWDG_Prescaler_8                    ((uint32_t)0x00000180)  

      #define CFR_WDGTB_MASK                      ((uint32_t)0xFFFFFE7F)  

      #define RCC_APB1ENR_WWDGEN                  ((uint32_t)0x00000800)        /*!< Window Watchdog clock enable */  

        

      /*================================================================== 

      * Function  : Wdog_Init 

      * Description   : 看門狗初始化 

      * Input Para    :  

      * Output Para   :  

      * Return Value:  

      ==================================================================*/  

      void Wdog_Init(void)  

      {  

          Wdog_Start();  

          WWDG->CFR |= 0x7F;   //窗口看門狗的上窗口,窗口值必須在0x3F以上,但必須小于計數(shù)值小于0x7F  

        

          WWDG->CR = 0x7F; //看門狗計數(shù)值  

        

          Wdog_Feed(0);  

      }  

        

        

        

      /*================================================================== 

      * Function  : Wdog_Start 

      * Description   : 啟動開門狗 

      * Input Para    :  

      * Output Para   :  

      * Return Value:  

      ==================================================================*/  

      void Wdog_Start(void)  

      {  

          RCC->APB1ENR |= RCC_APB1ENR_WWDGEN;  

          //設(shè)置分頻時鐘  

          WWDG->CFR = (WWDG->CFR & CFR_WDGTB_MASK) | WWDG_Prescaler_8;  

        

          WWDG->CR |= 0x80; //使能窗口看門狗   

      }  

        

      /*================================================================== 

      * Function  : Wdog_SetReload 

      * Description   : 重新設(shè)置頻率 

      * Input Para    :  

      * Output Para   :  

      * Return Value:  

      ==================================================================*/  

      void Wdog_SetReload(u8 uTime)  

      {  

        

      }  

        

      /*================================================================== 

      * Function  : Wdog_Feed 

      * Description   : 喂狗 

      * Input Para    :  

      * Output Para   :  

      * Return Value:  

      ==================================================================*/  

      void    Wdog_Feed(u8 uTime)  

      {  

           if ((WWDG->CR & 0x7F) < WWDG->CFR)//小于窗口值才能喂狗    

          {  

              WWDG->CR |= 0x7F;    //重新喂狗    

           }  

      }  

        

        

        

      /*================================================================== 

      * Function  : Wdog_ResetChip 

      * Description   : 復(fù)位芯片 

      * Input Para    :  

      * Output Para   :  

      * Return Value:  

      ==================================================================*/  

      void Wdog_ResetChip(void)  

      {  

          while ((WWDG->CR & 0x7F) >= WWDG->CFR)  

          {//等待進入到喂狗窗口  

          }  

          WWDG->CR &= 0x40;    //喂最小復(fù)位  

          while(1);  


      上海意泓電子科技有限責(zé)任公司 版權(quán)所有 未經(jīng)授權(quán)禁止復(fù)制或鏡像

      CopyRight 2020-2025 www.hljhgw.com All rights reserved   滬ICP備2021005866號

      国产强伦姧在线观看,…中文天堂在线一区,亚洲欧洲精品污网站在线观看,在线视频综合站 亚太影院 柯西贝尔-游戏赚网
      <tfoot id="ygvxt"><menuitem id="ygvxt"></menuitem></tfoot>
        • <kbd id="ygvxt"></kbd>
          <th id="ygvxt"><progress id="ygvxt"></progress></th>

          亚洲天堂免费看无码片| AV中文字幕不卡| 亚洲综合av一区二区三区| 免费无码又爽又刺激高潮久久| 久久精品国产二区| 亚洲自拍偷拍综合网| 欧洲一区二区在线观看| 亚洲人成在线观看不卡| 有码无码中文人妻视频| 伊人久久综合大杳蕉中文无码| 亚洲无码视频视频| 亚洲中文字幕4444| 免费av手机在线观看不卡| 久久人人爽人人爽人人ab东京热| 免费av手机在线观看不卡| 亚洲激情无码在线| 欧美亚洲精品中文字幕乱码免费高清| 日韩一区二区三区无码视频| 精品熟女久久少妇aⅴ免费狠狠| 国产喷水在线视频观看网站| 无码爆乳少妇中文字幕| 竹菊影视欧美日韩一区二区三区四区五区|