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

📄 fun_16.lst

📁 128*160液晶显示程序.该程序驱动芯片是89C51.
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.09   FUN_16                                                                02/16/2006 16:40:29 PAGE 1   


C51 COMPILER V7.09, COMPILATION OF MODULE FUN_16
OBJECT MODULE PLACED IN fun_16.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE fun_16.C BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include "config.h"
   2          
   3          extern void delay(uint16 n);  
   4          /****************************************************
   5          * Function
   6          *****************************************************/
   7          void data_out(uint8 dataH,dataL)
   8          {
   9   1          //8080 INTERFACE
  10   1          CS1 =0;
  11   1          DC  = 1;
  12   1          WR1 = 0;
  13   1          P1  = dataL;
  14   1          P0  = dataH;
  15   1          WR1 = 1;
  16   1              CS1 = 1;
  17   1      
  18   1      }
  19          
  20          void comm_out(uint8 i)
  21          {
  22   1          //8080 INTERFACE
  23   1          CS1 = 0;
  24   1          DC  = 0;
  25   1          WR1 = 0;
  26   1          P1  = i;
  27   1          WR1 = 1;
  28   1              CS1 = 1;
  29   1      
  30   1      }
  31          
  32          
  33          
  34          void selectSeries(uint8 i)
  35          {
  36   1      
  37   1         //SELECT SERIES 
  38   1         switch(i)
  39   1         {
  40   2            case 0:
  41   2                  //MI   = 0;//SELECT  8080
  42   2                  RD1  = 1;
  43   2                  WR1  = 1;
  44   2                  break;
  45   2            case 1:
  46   2                  //MI   = 1; //SELECT  6800
  47   2                  RD1  = 0;
  48   2                  WR1  = 0;
  49   2                  break;
  50   2            default:
  51   2                  ;
  52   2      
  53   2         }
  54   1      }
  55          
C51 COMPILER V7.09   FUN_16                                                                02/16/2006 16:40:29 PAGE 2   

  56          void ini_lcd(void)      
  57          {
  58   1          unsigned char i;
  59   1              comm_out(0xD1);   // enable  internal osc
  60   1      
  61   1          comm_out(0x20);   // set power control register
  62   1          data_out(0,0x0f); // 7x 
  63   1      
  64   1          comm_out(0x81);   // set contrast and internal Regulator resistor ratio
  65   1          data_out(0,20);
  66   1          data_out(0,5);   // 14.5v
  67   1      
  68   1          comm_out(0xFB);   // set bias 1/9
  69   1          data_out(0,2);
  70   1      /*
  71   1          comm_out(0xca);   // select duty  1/128
  72   1          data_out(0,0);
  73   1          data_out(0,31);
  74   1          data_out(0,0);
  75   1        */ 
  76   1          
  77   1          comm_out(0xF2);   // set frame ferquency
  78   1          data_out(0,0x07);
  79   1          data_out(0,0x10);
  80   1          
  81   1         
  82   1          comm_out(0xA7);   // set normal-a6   inverse-a7
  83   1      
  84   1          comm_out(0xBC);   // set data output scan direction
  85   1          data_out(0,0x02);
  86   1          data_out(0,0x01);
  87   1          data_out(0,0x03); // 0-64k
  88   1      
  89   1        /*  comm_out(0xF1);   // set com sequence
  90   1          data_out(0,0xf0); // com1->com131,com0->com132
  91   1          data_out(0,0x00);
  92   1          data_out(0,0x00);
  93   1      */
  94   1          comm_out(0xBB);   // set com output
  95   1          data_out(0,2);
  96   1      
  97   1      
  98   1      
  99   1          comm_out(0x15);         // Set col address
 100   1          data_out(0,2);          // Start col address
 101   1          data_out(0,129);    // End col address
 102   1          comm_out(0x75);         // Set page address
 103   1          data_out(0,0);          // Start page address
 104   1          data_out(0,159);    // End page address
 105   1          comm_out(0x5c);         // Write Display Data
 106   1      
 107   1          comm_out(0x94);    // exit sleep  mode
 108   1         // comm_out(0xa9);    // exit partial
 109   1          comm_out(0xAF);    // display on
 110   1          comm_out(0xce); // set color look-up table
 111   1          for(i=0;i<32;i++)
 112   1              data_out(i);
*** WARNING C209 IN LINE 112 OF FUN_16.C: '_data_out': too few actual parameters
 113   1      
 114   1      
 115   1      }
 116          
C51 COMPILER V7.09   FUN_16                                                                02/16/2006 16:40:29 PAGE 3   

 117          
 118          void setDispArea(uint16 s_col,e_col,s_page,e_page)
 119          {
 120   1        comm_out(0x15);           // Set col address
 121   1        data_out(0,s_col);    // Start col address
 122   1        data_out(0,e_col);    // End col address
 123   1        comm_out(0x75);           // Set page address
 124   1        data_out(0,s_page);   // Start page address
 125   1        data_out(0,e_page);   // End page address
 126   1      
 127   1      }
 128          /*
 129          void setColorLookUp(void)
 130          {
 131                  uint8 i;
 132          
 133                  comm_out(0xce);    // set color look-up table
 134                  for(i=0;i<32;i++)
 135                          data_out(i);
 136          }
 137          */
 138          void setColorMode(uint8 i)
 139          {
 140   1              switch(i)
 141   1              {
 142   2                      case 1:
 143   2                          comm_out(0xBC);   // set data output scan direction
 144   2                          data_out(0,0x00);
 145   2                          data_out(0,0x01);
 146   2                          data_out(0,0x01); // 0-256
 147   2                      case 2:
 148   2                          comm_out(0xBC);   // set data output scan direction
 149   2                          data_out(0,0x00);
 150   2                          data_out(0,0x01);
 151   2                          data_out(0,0x00); // 0-64k
 152   2                      default:
 153   2                              ;
 154   2              }
 155   1      
 156   1      }
 157          
 158          void dispColor(uint16 row,col,uint8 colorMode,uint8 rgb1,rgb2,uint8 dly)
 159          {
 160   1        uint16 i,j;
 161   1        
 162   1        setColorMode(colorMode);
 163   1      
 164   1        comm_out(0x5c);               // Write Display Data
 165   1        for(i=0;i<row;i++)
 166   1        {
 167   2           for(j=0;j<col;j++)
 168   2           {
 169   3              data_out(rgb1,rgb2); 
 170   3                      delay(dly);
 171   3           }
 172   2        }
 173   1      }
 174          
 175          
 176          void dispPic(uint16 row,col,uint8 colorMode,uint8 code *picture)
 177          {
 178   1              uint16  i,j;
C51 COMPILER V7.09   FUN_16                                                                02/16/2006 16:40:29 PAGE 4   

 179   1              setColorMode(colorMode);
 180   1              switch (colorMode)
 181   1          {
 182   2              case 1:
 183   2              //p256d
 184   2                      comm_out(0x5c);         // Write Display Data
 185   2                      for(i=0;i<row;i++)
 186   2                  {
 187   3                  for(j=0;j<col;j++)
 188   3                          {
 189   4                              data_out(*(picture++),*picture);
 190   4                              picture ++;
 191   4                  }
 192   3                  }
 193   2      
 194   2              break;
 195   2      
 196   2              case 2:
 197   2              //p64kd
 198   2                      comm_out(0x5c);         // Write Display Data
 199   2                      for(i=0;i<row;i++)
 200   2                  {
 201   3                  for(j=0;j<col;j++)
 202   3                          {
 203   4                              data_out(*picture,*(++picture));
 204   4                              picture ++;
 205   4                  }
 206   3                  }
 207   2              break;
 208   2      
 209   2              default:
 210   2              ;
 211   2        }
 212   1      
 213   1      }
 214          
 215          
 216          void dispColorY(uint16 row,col,uint8 colorMode,uint8 rgbA1, rgbA2,rgbB1,rgbB2,rgbC1,rgbC2,rgbD1,rgbD2)
 217          {
 218   1      
 219   1         
 220   1          uint16 i,j;
 221   1          setColorMode(colorMode);
 222   1      
 223   1              comm_out(0x5c);         // Write Display Data
 224   1      
 225   1              for(i=0;i<row;i++)
 226   1              {
 227   2                      for(j=0;j<col/4;j++)
 228   2                      {
 229   3                         data_out(rgbA1,rgbA2);
 230   3                      }
 231   2      
 232   2                      for(j=0;j<col/4;j++)
 233   2                      {
 234   3                         data_out(rgbB1,rgbB2);
 235   3                      }
 236   2      
 237   2                      for(j=0;j<col/4;j++)
 238   2                      {
 239   3                         data_out(rgbC1,rgbC2);
 240   3                      }
C51 COMPILER V7.09   FUN_16                                                                02/16/2006 16:40:29 PAGE 5   

 241   2      
 242   2                      for(j=0;j<col/4;j++)
 243   2                      {
 244   3                         data_out(rgbD1,rgbD2);
 245   3                      }
 246   2              }
 247   1      }
 248          
 249          
 250          
 251          void dispColorX(uint16 row,col,uint8 colorMode,uint8 rgbA1,rgbA2,rgbB1,rgbB2,rgbC1,rgbC2,rgbD1,rgbD2)
 252          {
 253   1      
 254   1          uint16 i,j,k;
 255   1      
 256   1          setColorMode(colorMode);
 257   1      
 258   1          k = row /4;
 259   1              comm_out(0x5c);         // Write Display Data
 260   1          for(i=0;i<k;i++)
 261   1              {
 262   2             for(j=0;j<col;j++)
 263   2                 {
 264   3                  data_out(rgbA1,rgbA2);
 265   3             }
 266   2              }
 267   1              for(i=0;i<k;i++)
 268   1              {
 269   2             for(j=0;j<col;j++)
 270   2                 {
 271   3                  data_out(rgbB1,rgbB2);
 272   3             }
 273   2              }
 274   1              for(i=0;i<k;i++)
 275   1              {
 276   2             for(j=0;j<col;j++)
 277   2                 {
 278   3                  data_out(rgbC1,rgbC2);
 279   3             }
 280   2              }
 281   1      
 282   1              for(i=0;i<k;i++)
 283   1              {
 284   2             for(j=0;j<col;j++)
 285   2                 {
 286   3                  data_out(rgbD1,rgbD2);
 287   3             }
 288   2              }
 289   1      
 290   1      }
 291          
 292          

⌨️ 快捷键说明

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