⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcd.lst

📁 keil c开发 16位液晶显示屏驱动程序
💻 LST
字号:
C51 COMPILER V7.01  LCD                                                                    07/01/2003 15:28:39 PAGE 1   


C51 COMPILER V7.01, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN lcd.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE lcd.c OPTIMIZE(7,SPEED) BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          #include <reg52.h>    
   2          #define uchar unsigned char
   3          idata char flag0 ;
   4          idata char flag1 ;
   5          idata char flag2 ;
   6          idata char flag3 ;
   7          idata char flag4 ;
   8          idata char flag5 ;
   9          idata char flag6 ;
  10          idata char flag7 ;
  11          sbit RS=P2^3;
  12          sbit RW=P2^4;
  13          sbit LCDE=P2^5;
  14          sbit big=P3^2;
  15          sbit fd=P3^3;
  16          unsigned char line1[16],line2[16];
  17          unsigned char code cgram[64]={0x1e,0x02,0x03,0x02,0x03,0x02,0x02,0x03,0x12,0x02,0x17,0x12,0x15,0x15,0x10,0
             -x1f,
  18          0x04,0x1f,0x15,0x1f,0x15,0x1f,0x04,0x07,0x0e,0x02,0x04,0x1f,0x04,0x04,0x0c,0x04};//飞达电子
  19          unsigned char code cgram1[64]={0x00,0x1f,0x12,0x09,0x1f,0x11,0x01,0x0f,
  20          0x1e,0x04,0x04,0x08,0x1f,0x01,0x00,0x1e,
  21          0x02,0x03,0x06,0x05,0x04,0x09,0x09,0x12,
  22          0x00,0x1c,0x04,0x08,0x10,0x18,0x04,0x07,
  23          0x00,0x0f,0x09,0x09,0x0f,0x09,0x09,0x0f,0x00,0x1c,0x04,0x04,0x1c,0x04,0x04,0x1c,
  24          0x00,0x04,0x14,0x14,0x14,0x04,0x04,0x03,0x00,0x12,0x13,0x11,0x01,0x04,0x04,0x1c};//爱思
  25          
  26          
  27          void delay5ms()
  28          {
  29   1              register int i;
  30   1              for (i=0;i<1000;i++)
  31   1              ;
  32   1      }
  33          
  34          void delay50us()
  35          {
  36   1              register int i;
  37   1              for (i=0;i<20;i++)
  38   1              ;
  39   1      }
  40          
  41          wr_com(unsigned char comm)
  42          {
  43   1                      LCDE=0;
  44   1                      RS=0;
  45   1                      RW=0;
  46   1                      LCDE=1;
  47   1                      P0=comm;
  48   1                      RS=0;
  49   1                      RW=0;
  50   1                      LCDE=0;
  51   1      }
  52          
  53          wr_data(unsigned char dat)
  54          {
C51 COMPILER V7.01  LCD                                                                    07/01/2003 15:28:39 PAGE 2   

  55   1                      LCDE=0;
  56   1                      RS=0;
  57   1                      RW=0;
  58   1                      RS=1;
  59   1                      RW=0;
  60   1                      LCDE=1;
  61   1                      P0=dat;
  62   1                      LCDE=0;
  63   1                      RS=0;
  64   1                      RW=0;
  65   1      }
  66          
  67          
  68          unsigned char rd_bf()
  69          {
  70   1                      unsigned char i;
  71   1                      P0=0xff;
  72   1                      LCDE=0;
  73   1                      RS=0;
  74   1                      RW=0;
  75   1                      RS=0;
  76   1                      RW=1;
  77   1                      LCDE=1;
  78   1                      i=P0;
  79   1                      LCDE=0;
  80   1                      return(i);
  81   1      }
  82                  
  83          void init()
  84          {
  85   1              unsigned char in,i;
  86   1              wr_com(0x30);
  87   1              delay5ms();
  88   1              wr_com(0x30);
  89   1              delay5ms();
  90   1              wr_com(0x30);
  91   1              delay5ms();
  92   1              in=rd_bf();
  93   1              delay5ms();
  94   1              wr_com(0x01);
  95   1              delay5ms();
  96   1              in=rd_bf();
  97   1              delay5ms();
  98   1              wr_com(0x06);
  99   1              delay5ms();
 100   1              in=rd_bf();
 101   1              delay50us();
 102   1              wr_com(0x38);
 103   1              delay50us();
 104   1              in=rd_bf();
 105   1              delay50us();
 106   1              wr_com(0x0c);
 107   1              delay50us();
 108   1              in=rd_bf();
 109   1              delay50us();
 110   1              
 111   1              wr_com(0x40);           //set cgram address
 112   1              delay50us();
 113   1              in=rd_bf();
 114   1              delay50us();
 115   1              for(i=0;i<64;i++)
 116   1              {
C51 COMPILER V7.01  LCD                                                                    07/01/2003 15:28:39 PAGE 3   

 117   2                      wr_data(cgram1[i]);             //display "0"
 118   2                      delay50us();
 119   2                      in=rd_bf();
 120   2              }
 121   1              
 122   1              
 123   1      
 124   1      
 125   1      
 126   1      
 127   1      
 128   1      
 129   1      }
 130          
 131          
 132          display_162()
 133          {
 134   1                              unsigned char in,i;
 135   1                      wr_com(0x80);           //set ram address
 136   1                      delay50us();
 137   1                      in=rd_bf();
 138   1                      delay50us();
 139   1                      for(i=0;i<16;i++)
 140   1                      {
 141   2                              wr_data(line1[i]);              //display "0"
 142   2                              delay50us();
 143   2                              in=rd_bf();
 144   2                      }
 145   1                      in=rd_bf();
 146   1                      delay50us();
 147   1                      wr_com(0xc0);
 148   1                      delay50us();
 149   1                      in=rd_bf();
 150   1                      delay50us();
 151   1                      for(i=0;i<16;i++)
 152   1                      {
 153   2                              wr_data(line2[i]);              //display "0"
 154   2                              delay50us();
 155   2                              in=rd_bf();
 156   2                      }
 157   1      }
 158          main()
 159          {
 160   1              unsigned char in,i,da;
 161   1              delay5ms();
 162   1              delay5ms();
 163   1              delay5ms();
 164   1              delay5ms();
 165   1                 
 166   1                      
 167   1              init(); 
 168   1      
 169   1              while(1)
 170   1              {
 171   2                      if(fd==1)
 172   2                      {
 173   3                                      line1[0]=0x20;
 174   3                                      line1[1]=0;             //display "爱思"
 175   3                                      line1[2]=1;
 176   3                                      line1[3]=4;
 177   3                                      line1[4]=5;
 178   3                                      line1[5]=0x20;
C51 COMPILER V7.01  LCD                                                                    07/01/2003 15:28:39 PAGE 4   

 179   3                                      line1[6]=0;             //display "爱思"
 180   3                                      line1[7]=1;
 181   3                                      line1[8]=4;
 182   3                                      line1[9]=5;
 183   3                                      line1[10]=0x20;
 184   3                                      line1[11]=0;            //display "爱思"
 185   3                                      line1[12]=1;
 186   3                                      line1[13]=4;
 187   3                                      line1[14]=5;
 188   3                                      line1[15]=0x20;
 189   3                                      
 190   3                                      line2[0]=0x20;
 191   3                                      line2[1]=2;             //display "爱思"
 192   3                                      line2[2]=3;
 193   3                                      line2[3]=6;
 194   3                                      line2[4]=7;
 195   3                                      line2[5]=0x20;
 196   3                                      line2[6]=2;             //display "爱思"
 197   3                                      line2[7]=3;
 198   3                                      line2[8]=6;
 199   3                                      line2[9]=7;
 200   3                                      line2[10]=0x20;
 201   3                                      line2[11]=2;            //display "爱思"
 202   3                                      line2[12]=3;
 203   3                                      line2[13]=6;
 204   3                                      line2[14]=7;
 205   3                                      line2[15]=0x20;
 206   3                              
 207   3                      }       
 208   2              else if(big==1)
 209   2              {
 210   3                      da=0x41;
 211   3                      for(i=0;i<16;i++)
 212   3                      {
 213   4                              line1[i]=da;
 214   4                              da++;   
 215   4                      }
 216   3                      
 217   3                      
 218   3                      da=0x51;
 219   3                      for(i=0;i<16;i++)
 220   3                      {
 221   4                              line2[i]=da;
 222   4                              da++;   
 223   4                      }
 224   3              }
 225   2              else
 226   2              {
 227   3                      da=0x61;
 228   3                      for(i=0;i<16;i++)
 229   3                      {
 230   4                              line1[i]=da;
 231   4                              da++;   
 232   4                      }
 233   3                      
 234   3                      
 235   3                      da=0x71;
 236   3                      for(i=0;i<16;i++)
 237   3                      {
 238   4                              line2[i]=da;
 239   4                              da++;   
 240   4                      }
C51 COMPILER V7.01  LCD                                                                    07/01/2003 15:28:39 PAGE 5   

 241   3              }
 242   2              display_162();  
 243   2              }
 244   1      }
*** WARNING C280 IN LINE 160 OF LCD.C: 'in': unreferenced local variable


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    497    ----
   CONSTANT SIZE    =    128    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     32       1
   IDATA SIZE       =      8    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -