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

📄 lcd_driver.lst

📁 128x64点阵液晶屏驱动
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.50   LCD_DRIVER                                                            01/11/2007 16:46:40 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE LCD_DRIVER
OBJECT MODULE PLACED IN LCD_Driver.OBJ
COMPILER INVOKED BY: E:\Keil\C51\BIN\C51.EXE LCD_Driver.c OPTIMIZE(0,SPEED) BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include "LCD_Driver.h"
*** WARNING C329 IN LINE 16 OF LCD_Driver.h: single-line comment contains line-continuation
*** WARNING C329 IN LINE 17 OF LCD_Driver.h: single-line comment contains line-continuation
   2          #include "time.h"
   3          
   4          int x0 = 0, y0 = 0;
   5          int myX = 0, prevY = 0;
   6          code unsigned char coordinate[4] = {0x80, 0x90, 0x88, 0x98};
   7          char isCharacter = 0;
   8          unsigned char prevchar;
   9          
  10          void lcd_send_byte(char dat)
  11          {
  12   1      /*      int i;
  13   1      
  14   1              for(i = 0; i < 8; i++)
  15   1              {
  16   1                      if(dat & 0x80)
  17   1                              SET_LCD_SID(1);
  18   1                      else
  19   1                              SET_LCD_SID(0);
  20   1                      //Delay(1);
  21   1                      SET_LCD_SCLK(1);
  22   1                      //Delay(1);
  23   1                      SET_LCD_SCLK(0);
  24   1                      //Delay(1);
  25   1                      dat <<= 1;
  26   1              }*/
  27   1      }
*** WARNING C280 IN LINE 10 OF LCD_DRIVER.C: 'dat': unreferenced local variable
  28          
  29          void lcd_send_word(int dat)
  30          {
  31   1      /*      int i;
  32   1      
  33   1              for(i = 0; i < 16; i++)
  34   1              {
  35   1                      if(dat & 0x8000)
  36   1                              SET_LCD_SID(1);
  37   1                      else
  38   1                              SET_LCD_SID(0);
  39   1                      //Delay(1);
  40   1                      SET_LCD_SCLK(1);
  41   1                      //Delay(1);
  42   1                      SET_LCD_SCLK(0);
  43   1                      //Delay(1);
  44   1                      dat <<= 1;
  45   1              }*/
  46   1      }
*** WARNING C280 IN LINE 29 OF LCD_DRIVER.C: 'dat': unreferenced local variable
  47          
  48          void lcd_write_instruction(char ins)
  49          {
  50   1      /*      char start_byte;
  51   1              int command;
C51 COMPILER V7.50   LCD_DRIVER                                                            01/11/2007 16:46:40 PAGE 2   

  52   1              
  53   1              start_byte = SYNC_CHARACTER;
  54   1              lcd_send_byte(start_byte);
  55   1      
  56   1              command = ins & 0xf0;
  57   1              command <<= 8;
  58   1              command &= 0xff00;
  59   1              command |= (ins & 0x0f) << 4;
  60   1      
  61   1              lcd_send_word(command);*/
  62   1              SET_LCD_RS(0);
  63   1              SET_LCD_RW(0);
  64   1              SET_LCD_DATA(ins);
  65   1              SET_LCD_E(1);
  66   1              SET_LCD_E(0);
  67   1      }
  68          
  69          void lcd_write_data(char dat)
  70          {
  71   1      /*      char start_byte;
  72   1              int command;
  73   1      
  74   1              start_byte = SYNC_CHARACTER | START_BYTE_RS;
  75   1              lcd_send_byte(start_byte);
  76   1      
  77   1              command = dat & 0xf0;
  78   1              command <<= 8;
  79   1              command &= 0xff00;
  80   1              command |= (dat & 0x0f) << 4;
  81   1      
  82   1              lcd_send_word(command);*/
  83   1              SET_LCD_RS(1);
  84   1              SET_LCD_RW(0);
  85   1              SET_LCD_DATA(dat);
  86   1              SET_LCD_E(1);
  87   1              SET_LCD_E(0);
  88   1      }
  89          
  90          void lcd_init(int x, int y)
  91          {
  92   1      //      SET_LCD_SCLK(0);
  93   1      //      SET_LCD_CS(1);
  94   1              SET_LCD_RW(1);
  95   1              SET_LCD_RS(1);
  96   1              SET_LCD_E(1);
  97   1              SET_LCD_RESET(0);
  98   1              Delay(20);
  99   1              SET_LCD_RESET(1);
 100   1              Delay(20);
 101   1      
 102   1              lcd_write_instruction(0x38);
 103   1              Delay(20);
 104   1              lcd_write_instruction(0x38);
 105   1              Delay(20);                                
 106   1              lcd_write_instruction(0x38);
 107   1              Delay(20);
 108   1      
 109   1              lcd_write_instruction(0x01);
 110   1              Delay(20);
 111   1              lcd_write_instruction(0x06);
 112   1              Delay(20);
 113   1              lcd_write_instruction(0x0c);
C51 COMPILER V7.50   LCD_DRIVER                                                            01/11/2007 16:46:40 PAGE 3   

 114   1              Delay(20);
 115   1              
 116   1              x0 = x;
 117   1              y0 = y;
 118   1      }
 119          
 120          void lcd_char(int x, int y, unsigned short *buf, int height, int width)
 121          {
 122   1              int row, col;
 123   1      
 124   1              x -= x0;
 125   1              y -= y0;
 126   1              
 127   1              col = x / 16;
 128   1              
 129   1              if(y > 31)
 130   1              {
 131   2                      y -= 32;
 132   2                      col += 8;
 133   2              }
 134   1      
 135   1              if(y + height < 31)
 136   1                      for(row = 0; row < height; row++)
 137   1                      {
 138   2                              lcd_write_instruction(0x3e);
 139   2                              lcd_write_instruction(row + y | 0x80);
 140   2                              lcd_write_instruction(col | 0x80);
 141   2                              lcd_write_instruction(0x3a);
 142   2                              lcd_write_data(buf[row] >> 8);
 143   2                              lcd_write_data(buf[row] & 0x00ff);
 144   2                      }
 145   1              else
 146   1              {
 147   2                      x = 0;
 148   2                      for(row = 0; row < 32 - y; row++)
 149   2                      {
 150   3                              lcd_write_instruction(0x3e);
 151   3                              lcd_write_instruction(row + y | 0x80);
 152   3                              lcd_write_instruction(col | 0x80);
 153   3                              lcd_write_instruction(0x3a);
 154   3                              lcd_write_data(buf[x] >> 8);
 155   3                              lcd_write_data(buf[x] & 0x00ff);
 156   3                              x++;
 157   3                      }
 158   2      
 159   2                      for(row = 0; row < y - 32 + height; row++)
 160   2                      {
 161   3                              lcd_write_instruction(0x3e);
 162   3                              lcd_write_instruction(row | 0x80);
 163   3                              lcd_write_instruction(col + 8 | 0x80);
 164   3                              lcd_write_instruction(0x3a);
 165   3                              lcd_write_data(buf[x] >> 8);
 166   3                              lcd_write_data(buf[x] & 0x00ff);
 167   3                              x++;
 168   3                      }
 169   2              }
 170   1      
 171   1      }
*** WARNING C280 IN LINE 120 OF LCD_DRIVER.C: 'width': unreferenced local variable
 172          

⌨️ 快捷键说明

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