C51 COMPILER V9.02   LCD                                                                   12/24/2025 16:02:11 PAGE 1   


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

line level    source

   1          
   2          #ifndef _LCD_C_
   3          #define _LCD_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          #include "include/delay.h"
  11          #include "include/lcd_led.h"
  12          /*********************************************************************************************************
             -************/
  13                  
  14          void LCD_Init(void)
  15          {
  16   1              unsigned char i;
  17   1                      
  18   1              //初始化LCD驱动引脚
  19   1              P00F = P00_COM0_SETTING;
  20   1              P01F = P01_COM1_SETTING;
  21   1              P02F = P02_COM2_SETTING;
  22   1              P03F = P03_COM3_SETTING;         
  23   1                 
  24   1              P57F = P57_SEG0_SETTING;
  25   1              P34F = P34_SEG1_SETTING; 
  26   1              P35F = P35_SEG2_SETTING;  
  27   1              P56F = P56_SEG3_SETTING; 
  28   1              P50F = P50_SEG4_SETTING;
  29   1              P51F = P51_SEG5_SETTING;
  30   1              P52F = P52_SEG6_SETTING; 
  31   1              P53F = P53_SEG7_SETTING;
  32   1              P54F = P54_SEG8_SETTING;        
  33   1              
  34   1              //LCD RAM清零
  35   1              for(i = 0; i < 9; i++)
  36   1              {
  37   2                      INDEX = i;
  38   2                      LXDAT = 0;
  39   2              }
  40   1      
  41   1      #if (RTC_CLK_SELECT == IRCL)
  42   1              CKCON |= ILCKE;                                                 //使能IRCL
  43   1      #elif (RTC_CLK_SELECT == XOSCL) 
                      P72F = P72_XOSCL_IN_SETTING;                    //设置P72为晶振引脚
                      P71F = P71_XOSCL_OUT_SETTING;                   //设置P71为晶振引脚
                      CKCON |= XLCKE;                                                 //使能XSOCL
                      while(!(CKCON & XLSTA));                                //等待XSOCL稳定
              #endif
  49   1      
  50   1              LXDIVH = 0;                                                             //设置LCD时钟分频，目标帧频率为64HZ
  51   1              LXDIVL = 0;     
  52   1              LXCAD  = 0;
C51 COMPILER V9.02   LCD                                                                   12/24/2025 16:02:11 PAGE 2   

  53   1              LXCFG =  DMOD(DMOD_5ua) | BIAS(BIAS_1_3) | LDRV(LDRV_7);                        //设置LCD驱动电流、偏压(bias)、辉度
  54   1      #if (RTC_CLK_SELECT == IRCL)    
  55   1              LXCON =  LEN(LEN_IRCL) | LMOD(LMOD_lcd);                                                        //设置LCD时钟源为IRCL，选择LCD模式
  56   1      #else
                      LXCON =  LEN(LEN_XOSCL) | LMOD(LMOD_lcd);                                                       //设置LCD时钟源为XOSCL，选择LCD模式
              #endif
  59   1              
  60   1              //设置LCD全显
  61   1              for(i = 0; i < 9; i++)
  62   1              {
  63   2                      INDEX = i;
  64   2                      LXDAT = 0xFF;
  65   2              }
  66   1      }
  67          
  68          //若产品在进入休眠状态前需关闭LCD显示，请在关闭LCD功能前，将所设置的COM脚和SEG脚设置为输出模式并输出低电平
             -。此举可有效避免在关闭LCD功能时，LCD屏幕出现拖影现象。
  69          void LCD_Off(void)
  70          {
  71   1              P00 = 0;
  72   1              P01 = 0;
  73   1              P02 = 0;
  74   1              P03 = 0;         
  75   1             
  76   1              P57 = 0;
  77   1              P34 = 0; 
  78   1              P35 = 0;  
  79   1              P56 = 0; 
  80   1              P50 = 0;
  81   1              P51 = 0;
  82   1              P52 = 0; 
  83   1              P53 = 0;
  84   1              P54 = 0;
  85   1              
  86   1              P00F = OUTPUT;
  87   1              P01F = OUTPUT;
  88   1              P02F = OUTPUT;
  89   1              P03F = OUTPUT;   
  90   1             
  91   1              P57F = OUTPUT;
  92   1              P34F = OUTPUT; 
  93   1              P35F = OUTPUT;  
  94   1              P56F = OUTPUT; 
  95   1              P50F = OUTPUT;
  96   1              P51F = OUTPUT;
  97   1              P52F = OUTPUT; 
  98   1              P53F = OUTPUT;
  99   1              P54F = OUTPUT;
 100   1              
 101   1              LXCON = 0;                                              //关闭LCD功能
 102   1      }
 103          
 104          #endif


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    182    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
C51 COMPILER V9.02   LCD                                                                   12/24/2025 16:02:11 PAGE 3   

   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)
