C51 COMPILER V9.54   WDT                                                                   12/03/2024 14:58:48 PAGE 1   


C51 COMPILER V9.54, COMPILATION OF MODULE WDT
OBJECT MODULE PLACED IN .\Objects\wdt.obj
COMPILER INVOKED BY: C:\Keil_v5\C51\BIN\C51.EXE public\wdt.c OPTIMIZE(8,SPEED) BROWSE INCDIR(.\public) DEBUG OBJECTEXTEN
                    -D PRINT(.\Listings\wdt.lst) OBJECT(.\Objects\wdt.obj)

line level    source

   1          #include "wdt.h"
   2          
   3          /*WDT_TIME      = Twdtclk * (wdttime+1) * 4096
   4                                                          = (wdttime+1) * 0.128s
   5          wdttime :0 ~ 63
   6          */
   7          void WDT_Init( uint8_t wdttime)
   8          {
   9   1              WDTCON = wdttime << 2;          //WDT复位时间
  10   1              WDTCON |= 0x02;                 //WDT使能
  11   1              //reload
  12   1              WDTRLD = 0x5A;          //清空WDT计数器
  13   1              WDTRLD = 0x3C;
  14   1              
  15   1      }
  16          
  17          void WDT_RLD(void)
  18          {       
  19   1              //reload
  20   1               WDTRLD = 0x5A;
  21   1               WDTRLD = 0x3C;
  22   1      }
  23          
  24          /*WDT_TIME      = Twdtclk * (wdttime*4+3)
  25                                                          = (wdttime+1) * 0.000125s
  26          wdttime :0 ~ 256
  27          */
  28          void WDTTimer_Init( uint8_t wdttimer)
  29          {
  30   1                      WDTWK = wdttimer;               //看门狗唤醒寄存器 计数唤醒值
  31   1                      CLKEN1 |= 0x01;  //wdt时钟使能
  32   1                      INTCTRL |= 0x40;                //INT0选择WDT匹配信号
  33   1      //              INTCTRL |= 0x01;                //INT0下降沿产生中断
  34   1                      IEN0 |= 0x01;    //使能WDT唤醒中断
  35   1                      EA = 1;         
  36   1                      WDTCON |= 0xFC; //设置WDTTIME为最大值，防止唤醒后继续计数触发复位
  37   1                      WDTCON |= 0x02;         //使能看门狗            WDTCON必须在看门狗启动前配置
  38   1                      //计数器重载
  39   1                      WDT_RLD();
  40   1      }
  41          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     46    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
