C51 COMPILER V9.02   MAIN                                                                  12/12/2025 17:32:20 PAGE 1   


C51 COMPILER V9.02, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\output\main.obj
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE source\main.c OMF2 BROWSE DEBUG PRINT(.\lst\main.lst) OBJECT(.\output\main.
                    -obj)

line level    source

   1          #ifndef _MAIN_C_
   2          #define _MAIN_C_
   3          /*********************************************************************************************************
             -************/
   4          #include "include/ca51f_config.h"               
   5          #include "include/ca51f2sfr.h"
   6          #include "include/ca51f2xsfr.h"
   7          #include "include/gpiodef_f2.h"
   8          #include "include/system_clock.h"
   9          
  10          #include "include/wdt.h"
  11          #include "include/uart.h"
  12          #include "include/delay.h"
  13          #include <intrins.h>
  14          /*********************************************************************************************************
             -************/
  15          void main(void)
  16          {
  17   1      #if (SYSCLK_SRC == PLL)
                      Sys_Clk_Set_PLL(PLL_Multiple);  //设置系统时钟为PLL，PLL_Multiple为倍频倍数
              #endif
  20   1              
  21   1      #ifdef UART0_EN
                      Uart0_Initial(UART0_BAUTRATE);  //初始化UART0
              #endif
  24   1              
  25   1      #ifdef UART1_EN
                      Uart1_Initial(UART1_BAUTRATE);  //初始化UART1
              #endif
  28   1      
  29   1      #ifdef UART2_EN
                      Uart2_Initial(UART2_BAUTRATE);  //初始化UART2
              #endif
  32   1              
  33   1              EA = 1;                                                                                                 //开全局中断
  34   1      
  35   1      #ifdef PRINT_EN
                      uart_printf("Watch dog reset mode Demo code!\n");       
              #endif
  38   1      
  39   1      /***************************看门狗阈值设置计算公式如下****************************
  40   1      看门狗触发时间 = (WDVTH * 800H+7FFH) * clock cycle
  41   1      当看门狗时钟为3.6864M时,时间覆盖范围为0.56ms--36s
  42   1      *********************************************************************************/
  43   1      
  44   1      //看门狗时钟源为IRCH(内部高速时钟)      
  45   1              WDCON  = WDTS(WDTS_IRCH) | WDRE(WDRE_reset);    //设置看门狗时钟源为IRCH，模式为中断模式
  46   1              WDVTHH = 0x07;                                                                  //看门狗中断阈值高八位设置 当前值为1s
  47   1              WDVTHL = 0x08;                                                                  //看门狗中断阈值低八位设置
  48   1      
  49   1      //看门狗时钟源为XOSCL
  50   1      //      P72F = P72_XOSCL_IN_SETTING;                                    //设置P72为晶振引脚
  51   1      //      P71F = P71_XOSCL_OUT_SETTING;                                   //设置P71为晶振引脚
  52   1      //      CKCON |= XLCKE;                                                                 //使能XSOCL
C51 COMPILER V9.02   MAIN                                                                  12/12/2025 17:32:20 PAGE 2   

  53   1      //      while(!(CKCON & XLSTA));                                                //等待XSOCL稳定
  54   1      //      WDCON  = WDTS(WDTS_XOSCL) | WDRE(WDRE_reset);   //设置看门狗时钟源为XOSCL，模式为中断模式
  55   1      //      WDVTHH = 0;                                                                             //看门狗中断阈值高八位设置 当前值为1s
  56   1      //      WDVTHL = 0x0f;                                                                  //看门狗中断阈值低八位设置
  57   1      
  58   1      //看门狗时钟源为IRCL
  59   1      //      CKCON |= ILCKE;                                                                 //使能IRCL
  60   1      //      WDCON  = WDTS(WDTS_IRCL) | WDRE(WDRE_reset);    //设置看门狗时钟源为ILCKE，模式为中断模式
  61   1      //      WDVTHH = 0;                                                                             //看门狗中断阈值高八位设置 当前值为1s   
  62   1      //      WDVTHL = 0x0f;                                                                  //看门狗中断阈值低八位设置
  63   1      
  64   1              WDFLG = 0xA5;
  65   1              
  66   1      //      P25F = 2;                                       
  67   1              while(1)
  68   1              {
  69   2      //              P25 = ~25;      
  70   2              }
  71   1      }
  72          #endif


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     16    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
   EDATA SIZE       =   ----    ----
   HDATA SIZE       =   ----    ----
   XDATA CONST SIZE =   ----    ----
   FAR CONST SIZE   =   ----    ----
END OF MODULE INFORMATION.


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