C51 COMPILER V9.02   MAIN                                                                  12/11/2025 11:43:37 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/lcd_led.h"
  13          #include "include/delay.h"
  14          #include <intrins.h>
  15          /*********************************************************************************************************
             -************                        
  16                  本例程实现4com*9seg LED显示功能。
  17          **********************************************************************************************************
             -***********/                        
  18          
  19          void main(void)
  20          {
  21   1              unsigned char i;
  22   1      #ifdef LVD_RST_ENABLE
  23   1              LVDCON = 0xE1;                                  //设置LVD复位电压为2V
  24   1      #endif
  25   1      
  26   1      #if (SYSCLK_SRC == PLL)
                      Sys_Clk_Set_PLL(PLL_Multiple);  //设置系统时钟为PLL，PLL_Multiple为倍频倍数
              #endif
  29   1              
  30   1      #ifdef UART0_EN
                      Uart0_Initial(UART0_BAUTRATE);  //初始化UART0
              #endif
  33   1              
  34   1      #ifdef UART1_EN
                      Uart1_Initial(UART1_BAUTRATE);  //初始化UART1
              #endif
  37   1      
  38   1      #ifdef UART2_EN
                      Uart2_Initial(UART2_BAUTRATE);  //初始化UART2
              #endif
  41   1              
  42   1              EA = 1;                                                                                                 //开全局中断
  43   1      
  44   1      #ifdef PRINT_EN
                      uart_printf("LED Demo Code\n");
              #endif
  47   1      
  48   1              //初始化LED驱动引脚
  49   1              P00F = P00_COM0_SETTING;                        //设置P00为COM0
  50   1              P00C |= 0x80;                                                                   //设置P00为高灌电流模式
  51   1              
C51 COMPILER V9.02   MAIN                                                                  12/11/2025 11:43:37 PAGE 2   

  52   1              P01F = P01_COM1_SETTING;                        //设置P01为COM1
  53   1              P01C |= 0x80;                                                                   //设置P01为高灌电流模式
  54   1              
  55   1              P02F = P02_COM2_SETTING;                        //设置P02为COM2
  56   1              P02C |= 0x80;                                                                   //设置P02为高灌电流模式
  57   1              
  58   1              P03F = P03_COM3_SETTING;                        //设置P03为COM3
  59   1              P03C |= 0x80;                                                                   //设置P03为高灌电流模式
  60   1             
  61   1                               
  62   1              //设置引脚为SEG功能
  63   1              P57F = P57_SEG0_SETTING;
  64   1              P34F = P34_SEG1_SETTING; 
  65   1              P35F = P35_SEG2_SETTING;  
  66   1              P56F = P56_SEG3_SETTING; 
  67   1              P50F = P50_SEG4_SETTING;
  68   1              P51F = P51_SEG5_SETTING;
  69   1              P52F = P52_SEG6_SETTING; 
  70   1              P53F = P53_SEG7_SETTING;
  71   1              P54F = P54_SEG8_SETTING;        
  72   1              
  73   1              //LED RAM清零
  74   1              for(i = 0; i < 9; i++)
  75   1              {
  76   2                      INDEX = i;
  77   2                      LXDAT = 0;
  78   2              }
  79   1      
  80   1              LXDIVH = 0;                                             //设置LED时钟分频
  81   1              LXDIVL = 112;   
  82   1              LXCFG =  COMHV(COM_L) | SEGHV(SEG_H) | BLNK(0) | LDRV(LDRV_7);          //设置LED COM、SEG有效电平，亮度级别
  83   1              LXCON =  LEN(LEN_IRCH) | LMOD(LMOD_led);                                                                                                        //设置LED时钟源，选择LED模式
  84   1              
  85   1              //设置LCD全显
  86   1              for(i = 0; i < 9; i++)
  87   1              {
  88   2                      INDEX = i;
  89   2                      LXDAT = 0xFF;
  90   2              }
  91   1              while(1)
  92   1              {
  93   2              }
  94   1      }
  95          #endif


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