C51 COMPILER V9.02   MAIN                                                                  12/12/2025 17:27:58 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/uart.h"
  11          #include "include/delay.h"
  12          #include <intrins.h>
  13          /*********************************************************************************************************
             -************/
  14          //寄存器T2CON定义
  15          #define TR2(N)   (N<<6)
  16          #define T2R(N)   (N<<4)         //N=0~3
  17          #define T2IE(N)  (N<<3)
  18          #define UCKS(N)  (N<<2)
  19          #define T2P(N)   (N)        //N=0~3
  20          
  21          //寄存器T2MOD定义
  22          #define TF2              (1<<7)
  23          #define CF2              (1<<6)
  24          #define RF2              (1<<5)
  25          #define CCFG(N)  (N<<3)         //N=0~3
  26          #define T2M(N)   (N)            //N=0~3
  27          /*********************************************************************************************************
             -************/
  28          void main(void)
  29          {
  30   1      #ifdef LVD_RST_ENABLE
  31   1              LVDCON = 0xE1;                                  //设置LVD复位电压为2V
  32   1      #endif
  33   1              
  34   1      #if (SYSCLK_SRC == PLL)
                      Sys_Clk_Set_PLL(PLL_Multiple);  //设置系统时钟为PLL，PLL_Multiple为倍频倍数
              #endif
  37   1              
  38   1      #ifdef UART0_EN
                      Uart0_Initial(UART0_BAUTRATE);  //初始化UART0
              #endif
  41   1              
  42   1      #ifdef UART1_EN
                      Uart1_Initial(UART1_BAUTRATE);  //初始化UART1
              #endif
  45   1      
  46   1      #ifdef UART2_EN
                      Uart2_Initial(UART2_BAUTRATE);  //初始化UART2
              #endif
  49   1              
  50   1              EA = 1;                                                                                                 //开全局中断
  51   1      
C51 COMPILER V9.02   MAIN                                                                  12/12/2025 17:27:58 PAGE 2   

  52   1      #ifdef PRINT_EN
                      uart_printf("Timer2 Compare Mode Demo Code\n");
              #endif
  55   1      
  56   1              P12F = P12_T2CP_SETTING;         
  57   1              T2CON = TR2(0) | T2R(0) | T2IE(0) | UCKS(0) | T2P(0);                                                                                                                                                                                   
             -                        
  58   1              T2MOD = CCFG(2) | T2M(1);                                               //设置为比较模式
  59   1               
  60   1              T2CH = 0x80;                                                                    //T2C值越小，T2CP输出占空比越大。
  61   1              T2CL = 0x00;
  62   1              TH2=0;                                                                          //计数初值
  63   1              TL2=0;                    
  64   1              T2CON |= TR2(1);                                                                //定时器2启动                                                                           
  65   1                      
  66   1              while(1)
  67   1              {
  68   2      
  69   2              }
  70   1      }
  71          #endif


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     31    ----
   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)
