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

📄 lcd.lst

📁 用51模拟的TFT RGB接口驱动程序(HS,VS,DE,PCLK时序)
💻 LST
字号:
C51 COMPILER V8.05a   LCD                                                                  12/25/2007 01:05:22 PAGE 1   


C51 COMPILER V8.05a, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN lcd.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE lcd.c DEBUG OBJECTEXTEND

line level    source

   1          
   2          /****************************************************************************
   3          * 公司名称:SITRONIX                                                                                             *
   4          * 模块名称:LCD.C                                                                                    *
   5          * 模块功能:IC与板子之间的接口函数,可以按需要作移植修改                                 *
   6          * 创建人员:Jim Yuan                                                                                                                     *
   7          * 创建日期:2007-6-26                                                                                                            *
   8          * 修改日期:2007-7-5                                                                                                             *
   9          ****************************************************************************/
  10          
  11          #include "lcd.h"
  12          #include "interface.h"
  13          
  14          #define PANEL_X_PIXEL   240
  15          #define PANEL_Y_PIXEL   320
  16          #define PANEL_X_SHIFT   0
  17          #define PANEL_Y_SHIFT   0
  18          
  19          /****************************************************************************
  20          * 函数名称:disp_area                                                                                            *
  21          * 函数功能:设置显示区域在RAM中的范围和位置                                                          *
  22          * 入口参数:x      LCM上的X坐标,从0开始                                      *     
  23          *                  y      LCM上的Y坐标,从0开始                                          *
  24          *          width  LCM上显示区域的宽度                                       *
  25          *          height LCM上显示区域的高度                                       *              
  26          * 出口参数:FALSE设置失败/TRUE设置成功                                                                   *
  27          * 创建日期:2007-6-8                                                                                                                     *
  28          * 修改日期:2007-6-26                                                                                                            *
  29          * 修改原因:增加函数返回值                                                                               *
  30          ****************************************************************************/
  31          uint8 disp_area(uint16 x, uint16 y, uint16 width, uint16 height)
  32          {   
  33   1          if ((x + width) > PANEL_X_PIXEL){return FALSE;}
  34   1          if ((y + height) > PANEL_Y_PIXEL){return FALSE;}
  35   1          writec(0x2A);               //column range
  36   1          writed(0x00);                               //start
  37   1              writed(x + PANEL_X_SHIFT);             
  38   1          writed(0x00);                               //end
  39   1              writed(x + PANEL_X_SHIFT + width - 1); 
  40   1               
  41   1          writec(0x2B);
  42   1              writed(((y + PANEL_Y_SHIFT) >> 8) & 0x0f);                              //page range
  43   1          writed((y + PANEL_Y_SHIFT) & 0xff);              //start
  44   1          writed(((y + PANEL_Y_SHIFT + height -1 ) >> 8) & 0x0f);   
  45   1          writed((y + PANEL_Y_SHIFT + height - 1) & 0xff); //end
  46   1      
  47   1          writec(0x2C);
  48   1          return TRUE;
  49   1      }
  50          
  51          void init(void)
  52          {       
  53   1              writec(0x11);//sleep out
  54   1              delay(30);
  55   1              writec(0xb0);
C51 COMPILER V8.05a   LCD                                                                  12/25/2007 01:05:22 PAGE 2   

  56   1              writed(0x00);//0xc
  57   1      
  58   1              writec(0xB1);//set frame rate control(normal mode/full colors)  
  59   1              writed(0x23);
  60   1              writed(0x10);
  61   1          writed(0x10);
  62   1      
  63   1              writec(0xB2);//set frame rate control(idle mode/8-colors)  
  64   1              writed(0x23);
  65   1              writed(0x10);
  66   1          writed(0x10);
  67   1      
  68   1              writec(0xB3);//set frame rate control(partial mode/full-colors)  
  69   1              writed(0x3e);
  70   1              writed(0x02);
  71   1          writed(0x02);
  72   1              writed(0x3e);
  73   1              writed(0x02);
  74   1          writed(0x02);
  75   1              
  76   1              writec(0xB6);//set behavior of source output at porch area  
  77   1              writed(0x02);
  78   1              writed(0x04);
  79   1      
  80   1              writec(0xBC);//turn off the VSYNC funtion 
  81   1              writed(0x02);
  82   1              writed(0x04);
  83   1      
  84   1              writec(0xC0);//set power system  
  85   1              writed(0x00);
  86   1      
  87   1              writec(0xC1);//set power system  
  88   1              writed(0xbb);
  89   1              writed(0x00);
  90   1      
  91   1              writec(0xC2);  
  92   1              writed(0x01);
  93   1              writed(0xD6);
  94   1              writed(0x85);
  95   1              writed(0x30);
  96   1              writed(0x05);
  97   1      
  98   1              writec(0xC3);  
  99   1              writed(0x01);
 100   1              writed(0x33);
 101   1              writed(0x01);
 102   1              writed(0x00);
 103   1              writed(0x00);
 104   1      
 105   1              writec(0xC4);  
 106   1              writed(0x01);
 107   1              writed(0xB3);
 108   1              writed(0x03);
 109   1              writed(0x00);
 110   1              writed(0x00);
 111   1      
 112   1              writec(0xC5);
 113   1              writed(0x80);  
 114   1              writed(0x22);
 115   1              writed(0x14);
 116   1      
 117   1              writec(0xC6);//set vcomAC level  
C51 COMPILER V8.05a   LCD                                                                  12/25/2007 01:05:22 PAGE 3   

 118   1              writed(0x18);
 119   1              writed(0x28);
 120   1      
 121   1              writec(0xF4);//set timing for sram  
 122   1              writed(0xFF);
 123   1              writed(0x3F);
 124   1      
 125   1              writec(0xFB);//set equalize mode of source output  
 126   1              writed(0x7F);
 127   1              writec(0x36);
 128   1              writed(0xC0);
 129   1      
 130   1              writec(0x20);
 131   1      
 132   1              writec(0x3A);
 133   1              writed(0x55);
 134   1      
 135   1              writec(0x29);//display on
 136   1      }
 137          
 138          
 139          void delay(uint8 tt)
 140          {
 141   1              system_delay_lcd(tt);
 142   1      }
 143          void disp_pattern(uint8 dat1, uint8 dat2)
 144          {
 145   1              uint32 i;
 146   1              uint32 x,y;
 147   1              x = PANEL_X_PIXEL;
 148   1              y = PANEL_Y_PIXEL;
 149   1              x = x * y;
 150   1              disp_area(0, 0, PANEL_X_PIXEL, PANEL_Y_PIXEL);
 151   1              for(i = 0; i < x; i++)
 152   1              {
 153   2                      writed(dat1);
 154   2                      writed(dat2);   
 155   2              }
 156   1      }
 157          void disp_data(uint8 dat)
 158          {
 159   1              writed(dat);
 160   1      }
 161          void disp_flash(uint8 rom, uint32 address)
 162          {
 163   1              uint32 i,w,h;
 164   1              w = PANEL_X_PIXEL;
 165   1              h = PANEL_Y_PIXEL;
 166   1              i = w * h;
 167   1              if (disp_area(0, 0, PANEL_X_PIXEL, PANEL_Y_PIXEL) == FALSE){return;}
 168   1          flash_data_out(rom, address, i);
 169   1      }
 170          void disp_hex(uint16 row, uint16 column, uint8 hex)
 171          {
 172   1          print_hex(row, column, hex);
 173   1      }
 174          void disp_string(uint16 row, uint16 column, uint8 *str)
 175          {
 176   1          print_string(row, column, str);
 177   1      }
 178          void disp_key_test(uint16 row, uint16 column)
 179          {
C51 COMPILER V8.05a   LCD                                                                  12/25/2007 01:05:22 PAGE 4   

 180   1              disp_string(row, column, "KEY TEST:");
 181   1              disp_hex(row, column + 9, key_test());
 182   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    730    ----
   CONSTANT SIZE    =     10    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      39
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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