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

📄 lgdp4524-2^2-hx8347(1).lst

📁 驱动IC-LG4524的驱动程序。该程序能点亮TFT2。2的LCM
💻 LST
字号:
C51 COMPILER V7.06   LGDP4524_2_2_HX8347_1_                                                02/07/2009 11:13:58 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE LGDP4524_2_2_HX8347_1_
OBJECT MODULE PLACED IN LGDP4524-2^2-HX8347(1).OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE LGDP4524-2^2-HX8347(1).c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          /************************************************
   2          dots            176*220
   3          controller      LGDP4524
   4          interface       8080/16bits   P1-L,P0-H
   5          ************************************************/
   6          #include <absacc.h>
   7          #include <reg51.h>
   8          #define uchar unsigned char
   9          #define uint unsigned int
  10          //#define p0XBYTE[0x0000]
  11          
  12          sbit cs         =P3^5;
  13          sbit res        =P3^4;
  14          sbit rs         =P2^3;
  15          sbit wr         =P2^2;
  16          sbit uc4    =P2^7;
  17          sbit uc6    =P2^5;
  18          sbit step= P2^0;
  19          
  20          #define         HSIZE           176
  21          #define         VSIZE           220
  22          void dis_bar();
  23          void pause();
  24          void display_image(void);
  25          
  26          
  27          unsigned char code image[]= {
  28          
  29          0x12,
  30          };
  31          
  32          
  33          void delay(uint t)
  34          {
  35   1              uchar t1;
  36   1              while(t--)
  37   1              for(t1=16;t1>0;t1--) //16
  38   1              {;}  //0.1ms
  39   1      }
  40          
  41          
  42          
  43          void write_data(uchar data_h,data_l)
  44          {
  45   1       uc4=0;
  46   1       uc6=0;
  47   1       cs=0; 
  48   1       rs=1;
  49   1       P0=data_h;
  50   1       P1=data_l;
  51   1       wr=0;
  52   1       wr=1;
  53   1       cs=1;
  54   1      
  55   1       }
C51 COMPILER V7.06   LGDP4524_2_2_HX8347_1_                                                02/07/2009 11:13:58 PAGE 2   

  56          
  57          
  58          void write_command1(uchar datac)
  59          {
  60   1       uc4=0;
  61   1       uc6=0;
  62   1       cs=0;
  63   1       rs=0;
  64   1       P1=datac;
  65   1       wr=0;
  66   1       wr=1;
  67   1       cs=1;
  68   1      
  69   1      }
  70          void write_command(uchar data_h,data_l)
  71          {
  72   1       uc4=0;
  73   1       uc6=0; 
  74   1       cs=0;
  75   1       rs=0;
  76   1       //wr=0;
  77   1       P0=0x00;
  78   1       P1=data_h;
  79   1       wr=0;
  80   1       //P0=data_l;
  81   1       //delay(0);
  82   1       wr=1;
  83   1       cs=1;
  84   1      
  85   1       cs=0;
  86   1       rs=1;
  87   1       //wr=0;
  88   1       P0=0x00;
  89   1       P1=data_l;
  90   1       wr=0;
  91   1       //P0=data_l;
  92   1       //delay(0);
  93   1       wr=1;
  94   1       cs=1;    
  95   1       
  96   1       }
  97          
  98          void initialization()
  99          {
 100   1      //int p,p1,p2;
 101   1      res=0;
 102   1      delay(350);
 103   1      res=1;
 104   1      delay(150);
 105   1      //*********************Initial code******************************
 106   1      write_command(0x00,0x07);write_data(0x00,0x00);
 107   1      write_command(0x00,0x12);write_data(0x00,0x00);
 108   1      write_command(0x00,0x13);write_data(0x00,0x00);
 109   1      write_command(0x00,0x14);write_data(0x03,0x31);
 110   1      delay(50);
 111   1      write_command(0x00,0x12);write_data(0x00,0x09);
 112   1      write_command(0x00,0x11);write_data(0x00,0x00);
 113   1      write_command(0x00,0x10);write_data(0x01,0x04);
 114   1      write_command(0x00,0x13);write_data(0x0C,0x4A);
 115   1      write_command(0x00,0x10);write_data(0x01,0x44);
 116   1      write_command(0x00,0x11);write_data(0x02,0x00);
 117   1      write_command(0x00,0x12);write_data(0x00,0x19);
C51 COMPILER V7.06   LGDP4524_2_2_HX8347_1_                                                02/07/2009 11:13:58 PAGE 3   

 118   1      delay(50);
 119   1      write_command(0x00,0x13);write_data(0x2C,0x2A);
 120   1      write_command(0x00,0x10);write_data(0x01,0x40);
 121   1      delay(50);
 122   1      write_command(0x00,0x60);write_data(0x20,0x00);
 123   1      write_command(0x00,0x60);write_data(0x00,0x00);
 124   1      write_command(0x00,0x61);write_data(0x00,0x02);
 125   1      delay(50);
 126   1      write_command(0x00,0x01);write_data(0x01,0x1B);
 127   1      write_command(0x00,0x02);write_data(0x07,0x00);
 128   1      write_command(0x00,0x03);write_data(0x10,0x30);
 129   1      write_command(0x00,0x09);write_data(0x00,0x00);
 130   1      write_command(0x00,0x0B);write_data(0x5D,0x2D);
 131   1      write_command(0x00,0x21);write_data(0x00,0x00);
 132   1      write_command(0x00,0x30);write_data(0x01,0x01);
 133   1      write_command(0x00,0x31);write_data(0x06,0x04);
 134   1      write_command(0x00,0x32);write_data(0x00,0x07);
 135   1      write_command(0x00,0x33);write_data(0x04,0x03);
 136   1      write_command(0x00,0x34);write_data(0x00,0x07);
 137   1      write_command(0x00,0x35);write_data(0x04,0x02);
 138   1      write_command(0x00,0x36);write_data(0x06,0x06);
 139   1      write_command(0x00,0x37);write_data(0x03,0x04);
 140   1      write_command(0x00,0x38);write_data(0x07,0x0E);
 141   1      write_command(0x00,0x39);write_data(0x07,0x0E);
 142   1      write_command(0x00,0x3A);write_data(0x01,0x01);
 143   1      write_command(0x00,0x3B);write_data(0x01,0x01);
 144   1      write_command(0x00,0x3C);write_data(0x01,0x01);
 145   1      write_command(0x00,0x3D);write_data(0x01,0x01);
 146   1      write_command(0x00,0x3E);write_data(0x00,0x01);
 147   1      write_command(0x00,0x3F);write_data(0x00,0x01);
 148   1      write_command(0x00,0x42);write_data(0xDB,0x00);
 149   1      write_command(0x00,0x44);write_data(0xAF,0x00);
 150   1      write_command(0x00,0x45);write_data(0xDB,0x00);
 151   1      delay(50);
 152   1      write_command(0x00,0x71);write_data(0x00,0x40);
 153   1      write_command(0x00,0x72);write_data(0x00,0x02);
 154   1      delay(50);
 155   1      write_command(0x00,0x10);write_data(0x32,0x50);
 156   1      delay(50);
 157   1      write_command(0x00,0x07);write_data(0x00,0x01);
 158   1      delay(50);
 159   1      write_command(0x00,0x07);write_data(0x00,0x21);
 160   1      write_command(0x00,0x07);write_data(0x00,0x23);
 161   1      delay(50);
 162   1      write_command(0x00,0x07);write_data(0x00,0x37);
 163   1      delay(50);
 164   1      }
 165          
 166          
 167          void display_rgb(uchar h_data,l_data)
 168          {
 169   1      
 170   1              uint i,j;
 171   1              //write_command1(0x20);
 172   1              for(i=0;i<HSIZE;i++)
 173   1                      for(j=0;j<VSIZE;j++)
 174   1                              {
 175   2                              write_data(h_data,l_data);
 176   2                              }
 177   1              //write_command(0x2c,0x2c);
 178   1      }
 179          
C51 COMPILER V7.06   LGDP4524_2_2_HX8347_1_                                                02/07/2009 11:13:58 PAGE 4   

 180          
 181          void main()
 182          {
 183   1              res=0;
 184   1              delay(20);
 185   1              res=1;
 186   1              delay(200);
 187   1              initialization();
 188   1              while(1)
 189   1              {
 190   2              /*display_image();
 191   2              delay(200000);
 192   2                      pause();*/
 193   2               dis_bar();
 194   2                      delay(200000);
 195   2                      pause();
 196   2              display_rgb(0xf8,0x00);
 197   2                      delay(200000);
 198   2                      pause();
 199   2                      display_rgb(0x07,0xe0);
 200   2                      delay(200000);
 201   2                      pause();
 202   2                      display_rgb(0x00,0x1f);
 203   2                      delay(200000);
 204   2                      pause();
 205   2                      display_rgb(0x00,0x00);
 206   2                      delay(200000);
 207   2                      pause();
 208   2                      display_rgb(0xff,0xff);
 209   2                      delay(200000);
 210   2             pause();
 211   2      
 212   2              }
 213   1      }
 214          
 215          void dis_bar(void)
 216          {
 217   1              int i,j,k;
 218   1      
 219   1          //write_command1(0x22);
 220   1      
 221   1                        for(i=0;i<22;i++)     //display line
 222   1                      {
 223   2                               for(j=0;j<VSIZE;j++)
 224   2                              {
 225   3                                 write_data(0xF8,0x00);
 226   3                              }
 227   2                      }
 228   1      
 229   1                        for(i=0;i<22;i++)     //display line
 230   1                      {
 231   2                              for(j=0;j<VSIZE;j++)
 232   2                              {
 233   3                              write_data(0x07,0xe0);
 234   3                              }
 235   2                      }
 236   1      
 237   1                        for(i=0;i<22;i++)     //display line
 238   1                      {
 239   2                              for(j=0;j<VSIZE;j++)
 240   2                              {
 241   3                               write_data(0x00,0x1f);
C51 COMPILER V7.06   LGDP4524_2_2_HX8347_1_                                                02/07/2009 11:13:58 PAGE 5   

 242   3                              }
 243   2                      }
 244   1      
 245   1                        for(i=0;i<22;i++)     //display line
 246   1                      {
 247   2                              for(j=0;j<VSIZE;j++)
 248   2                              {
 249   3                               write_data(0xfc,0x08);
 250   3      
 251   3                              }
 252   2                      }
 253   1      
 254   1                        for(i=0;i<22;i++)     //display line
 255   1                      {
 256   2                              for(j=0;j<VSIZE;j++)
 257   2                              {
 258   3                               write_data(0xff,0xe0);
 259   3      
 260   3                              }
 261   2                      }
 262   1      
 263   1                              for(i=0;i<22;i++)     //display line
 264   1                      {
 265   2                              for(j=0;j<VSIZE;j++)
 266   2                              {
 267   3                               write_data(0xff,0xff);
 268   3      
 269   3                              }
 270   2                      }
 271   1      
 272   1                              for(i=0;i<22;i++)     //display line
 273   1                      {
 274   2                              for(j=0;j<VSIZE;j++)
 275   2                              {
 276   3                               write_data(0xf8,0x1f);
 277   3      
 278   3                              }
 279   2                      }
 280   1      
 281   1                              for(i=0;i<22;i++)     //display line
 282   1                      {
 283   2                              for(j=0;j<VSIZE;j++)
 284   2                              {
 285   3                               write_data(0x00,0x00);
 286   3      
 287   3                              }
 288   2                      }
 289   1      
 290   1      }
*** WARNING C280 IN LINE 217 OF LGDP4524-2^2-HX8347(1).C: 'k': unreferenced local variable
 291          
 292          
 293          void pause()
 294          {
 295   1              while(!step);
 296   1      }
 297          
 298          
 299          
 300          
 301          
 302          
C51 COMPILER V7.06   LGDP4524_2_2_HX8347_1_                                                02/07/2009 11:13:58 PAGE 6   

 303          
 304          /*void display_image(void)
 305           {
 306            int i;
 307            int j;
 308            int k=0;
 309            write_command1(0x22);
 310            for(i=0;i<240;i++)
 311              {
 312                for(j=0;j<320;j++)
 313                {
 314               write_data(image[k++],image[k]);
 315                k++;
 316                }
 317               }
 318           // for(i=0;i<128*160;i++)
 319             // {
 320             //  write_data(image[i++],image[i]);
 321             // }
 322          
 323          // }
 324          
 325          }*/


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1107    ----
   CONSTANT SIZE    =      1    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       4
   IDATA SIZE       =   ----    ----
   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 + -