C51 COMPILER V9.02   MAIN                                                                  12/12/2025 17:24:13 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          
   2          #ifndef _MAIN_C_
   3          #define _MAIN_C_
   4          /*********************************************************************************************************
             -************/
   5          #include "include/ca51f_config.h"               
   6          #include "include/ca51f2sfr.h"
   7          #include "include/ca51f2xsfr.h"
   8          #include "include/gpiodef_f2.h"
   9          #include "include/system_clock.h"
  10          
  11          #include "include/uart.h"
  12          #include "include/delay.h"
  13          #include <intrins.h>
  14          /*********************************************************************************************************
             -************/
  15          
  16          #define INT_TIME                        10000           //定时时间，单位为us
  17          
  18          #define TH_VAL                          (unsigned char)((0x10000 - (INT_TIME*(FOSC/1000))/12000)>>8)
  19          #define TL_VAL                          (unsigned char)(0x10000 - (INT_TIME*(FOSC/1000))/12000)
  20          
  21          void TIMER0_ISR (void) interrupt 1              //每10ms产生中断
  22          {
  23   1              TH0 = TH_VAL;
  24   1              TL0 = TL_VAL;
  25   1              
  26   1      }
  27          void main(void)
  28          {
  29   1      #ifdef LVD_RST_ENABLE
  30   1              LVDCON = 0xE1;                                  //设置LVD复位电压为2V
  31   1      #endif
  32   1              
  33   1      #if (SYSCLK_SRC == PLL)
                      Sys_Clk_Set_PLL(PLL_Multiple);  //设置系统时钟为PLL，PLL_Multiple为倍频倍数
              #endif
  36   1              
  37   1      #ifdef UART0_EN
                      Uart0_Initial(UART0_BAUTRATE);  //初始化UART0
              #endif
  40   1              
  41   1      #ifdef UART1_EN
                      Uart1_Initial(UART1_BAUTRATE);  //初始化UART1
              #endif
  44   1      
  45   1      #ifdef UART2_EN
                      Uart2_Initial(UART2_BAUTRATE);  //初始化UART2
              #endif
  48   1              
  49   1              EA = 1;                                                                                                 //开全局中断
  50   1      
  51   1      #ifdef PRINT_EN
                      uart_printf("Timer0 Mode1 Demo Code\n");
C51 COMPILER V9.02   MAIN                                                                  12/12/2025 17:24:13 PAGE 2   

              #endif
  54   1      
  55   1              TMOD = (TMOD&0xFC)|0x01;                //模式选择: 定时器0，模式1。
  56   1              TH0 = TH_VAL;                                   //高8位装初值
  57   1              TL0 = TL_VAL;                                   //低8位装初值
  58   1              
  59   1              TR0 = 1;                                        //定时器0使能  
  60   1              ET0 = 1;                                        //定时器0中断使能
  61   1      //      PT0 = 1;                                        //设置定时器0中断优先级为高优先级
  62   1                      
  63   1              while(1)
  64   1              {
  65   2      
  66   2              }
  67   1      }
  68          #endif


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