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

📄 lcd_dis.lst

📁 AT89C51单片机控制LCD12864液晶显示器显示汉字;
💻 LST
字号:
C51 COMPILER V7.50   LCD_DIS                                                               10/19/2007 19:17:49 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE LCD_DIS
OBJECT MODULE PLACED IN lcd_dis.OBJ
COMPILER INVOKED BY: E:\Program Files\UV2\C51\BIN\C51.EXE lcd_dis.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          /***************************************************************\
   2          |*          12864LCD显示程序 proteus7.1仿真AMPIRE128*64       *|
   3          |*        Copyright (c) 2007山师.传播       */
   4          /*        All rights reserved.                  */
   5                    /*赵彦彬                                  *|
   6          |*                                       *|
   7          |*          
   8          \***************************************************************/
   9          
  10          
  11          
  12          
  13          
  14          
  15          #include <reg52.h>
  16                                    
  17          #include <string.h>
  18          
  19          
  20          typedef unsigned char uchar;
  21          typedef unsigned int  uint;
  22          typedef struct dword                
  23          {
  24           uchar dd[64];                      
  25          };
  26          
  27          struct dword code dis[30] =        // 数据表
  28          {
  29           0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0xFF,
  30                0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,
  31                0x00,0x7F,0x20,0x20,0x20,0x20,0x20,0x3F,
  32                0x20,0x20,0x20,0x20,0x20,0x7F,0x00,0x00,
  33           0x08,0x08,0x08,0x88,0x68,0x18,0x0F,0xE8,
  34                0x08,0x08,0x08,0x88,0x08,0x0C,0x08,0x00,
  35                0x00,0x40,0x21,0x11,0x0D,0x41,0x81,0x7F,
  36                0x01,0x05,0x09,0x31,0x61,0x00,0x00,0x00,
  37           0x00,0xFC,0x00,0x00,0xFF,0x00,0x02,0xF2,
  38                0x12,0x12,0xFE,0x12,0x12,0xFB,0x12,0x00,
  39                0x00,0x8F,0x40,0x30,0x0F,0x00,0x00,0x3F,
  40                0x00,0x00,0xFF,0x10,0x20,0x1F,0x00,0x00,
  41           0x04,0x44,0x94,0x24,0x6F,0x04,0xE4,0x24,
  42                0x24,0x24,0x2F,0xF4,0x24,0x06,0x04,0x00,
  43                0x04,0x04,0xFD,0x04,0x02,0x00,0x3F,0x40,
  44                0x40,0x42,0x44,0x43,0x40,0x40,0x70,0x00,
  45           0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x7F,
  46                0xA0,0x20,0x20,0x20,0x20,0x30,0x20,0x00,
  47                0x00,0x40,0x40,0x20,0x10,0x0C,0x03,0x00,
  48                0x01,0x06,0x08,0x10,0x20,0x60,0x20,0x00,
  49           0x40,0x30,0x11,0x96,0x90,0x90,0x91,0x96,
  50                0x90,0x90,0x98,0x14,0x13,0x50,0x30,0x00,
  51                0x04,0x04,0x04,0x04,0x04,0x44,0x84,0x7E,
  52                0x06,0x05,0x04,0x04,0x04,0x06,0x04,0x00,
  53           0x80,0x40,0x20,0xF8,0x47,0x48,0x48,0x48,
  54                0xC8,0x7F,0x48,0x48,0x4C,0x68,0x40,0x00,
  55                0x00,0x00,0x00,0xFF,0x00,0x00,0x02,0x0B,
C51 COMPILER V7.50   LCD_DIS                                                               10/19/2007 19:17:49 PAGE 2   

  56                0x12,0x62,0xD2,0x0A,0x06,0x02,0x00,0x00,
  57           0x10,0x10,0x10,0xFF,0x90,0x30,0xAA,0x72,
  58                0x22,0xFE,0x21,0x71,0xA9,0xAC,0xA0,0x00,
  59                0x02,0x42,0x81,0x7F,0x00,0x01,0xFE,0x92,
  60                0x92,0xFF,0x92,0x92,0xFE,0x01,0x00,0x00, 
  61          0x40,0x30,0x11,0x96,0x90,0x90,0x91,0x96,
  62                0x90,0x90,0x98,0x14,0x13,0x50,0x30,0x00,
  63                0x04,0x04,0x04,0x04,0x04,0x44,0x84,0x7E,
  64                0x06,0x05,0x04,0x04,0x04,0x06,0x04,0x00,
  65          0x00,0xFE,0x22,0x5A,0x96,0x0C,0x24,0x24,
  66                0x25,0x26,0x24,0x34,0xA4,0x14,0x0C,0x00,
  67                0x00,0xFF,0x04,0x08,0x87,0x81,0x41,0x31,
  68                0x0F,0x01,0x3F,0x41,0x41,0x41,0x70,0x00,
  69                
  70           0x40,0x48,0x48,0x48,0xFF,0x48,0x68,0x40,
  71                0x0C,0x30,0xC0,0x30,0x0E,0x00,0x00,0x00,
  72                0x40,0x30,0x0F,0x08,0x1F,0x22,0x42,0x48,
  73                0x44,0x43,0x40,0x41,0x46,0x6C,0x20,0x00,
  74           0x00,0x00,0xE4,0x24,0x2C,0x34,0x25,0x26,
  75                0xA4,0xB4,0x6C,0x26,0x24,0x30,0x20,0x00,
  76                0x40,0x30,0x0F,0x80,0x92,0x92,0x49,0x49,
  77                0x44,0x24,0x22,0x11,0x08,0x00,0x00,0x00,
  78           0x10,0x10,0xD0,0xFF,0x90,0x10,0x10,0xD0,
  79                0xFF,0x90,0x10,0x20,0x10,0x08,0xC6,0x00,
  80                0x04,0x03,0x00,0xFF,0x00,0x04,0x03,0x00,
  81                0xFF,0x00,0x81,0x44,0x22,0x11,0x0C,0x00,
  82           0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  83                0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  84                0x00,0x38,0x7C,0x44,0x44,0x7C,0x38,0x00,
  85                0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  86           0x20,0x22,0x2A,0x2A,0xAA,0x6A,0x3A,0x2F,
  87                0x2A,0x6A,0xAA,0x2A,0x2A,0x22,0x20,0x00,
  88                0x04,0x04,0x02,0x01,0xFF,0x49,0x49,0x49,
  89                0x49,0x49,0xFF,0x01,0x02,0x06,0x02,0x00,
  90          
  91           0x80,0x70,0x00,0xFF,0x10,0x20,0xFE,0x92,
  92                0x92,0x92,0x92,0x92,0xFF,0x02,0x00,0x00,
  93                0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x40,
  94                0x23,0x04,0x08,0x14,0x62,0xC3,0x40,0x00,
  95          
  96           0x24,0x24,0xA4,0xFE,0x23,0x22,0x80,0x70,
  97                0x00,0xFF,0x00,0x40,0x20,0x30,0x00,0x00,
  98                0x08,0x06,0x01,0xFF,0x81,0x42,0x20,0x18,
  99                0x06,0x01,0x06,0x08,0x30,0x60,0x20,0x00,
 100          
 101           0x82,0x92,0x92,0x92,0x92,0xFF,0x00,0x00,
 102                0x00,0xFF,0x92,0x92,0x9A,0xD3,0x82,0x00,
 103                0x20,0x18,0x00,0x3C,0x40,0x41,0x44,0x48,
 104                0x58,0x41,0x40,0x70,0x00,0x08,0x30,0x00,
 105          
 106           0x00,0x40,0x7F,0x44,0x44,0x26,0xA4,0x00,
 107                0x3F,0x48,0x48,0xC4,0x46,0x40,0x70,0x00,
 108                0x00,0x00,0x00,0xFF,0x49,0x49,0x49,0x49,
 109                0x49,0x49,0x49,0xFF,0x01,0x00,0x00,0x00,
 110          
 111           0x00,0x00,0x00,0xF8,0x48,0x4C,0x4A,0x49,
 112                0x48,0x48,0x48,0xFC,0x08,0x00,0x00,0x00,
 113                0x00,0x00,0x00,0xFF,0x44,0x44,0x44,0x44,
 114                0x44,0x44,0x44,0xFF,0x00,0x00,0x00,0x00,
 115          
 116           0x10,0x10,0x10,0xFF,0x90,0x50,0x20,0x20,
 117                0x20,0xFF,0xA0,0x22,0x24,0x30,0x20,0x00,
C51 COMPILER V7.50   LCD_DIS                                                               10/19/2007 19:17:49 PAGE 3   

 118                0x02,0x42,0x81,0x7F,0x00,0x80,0x40,0x30,
 119                0x0F,0x00,0x3F,0x40,0x40,0x40,0x70,0x00,
 120          
 121           0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 122                0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 123                0x00,0x00,0x00,0x46,0x2F,0x1F,0x06,0x00,
 124                0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 125          
 126           0x04,0x04,0x04,0xC4,0x3F,0x04,0x04,0x04,
 127                0xE4,0x04,0x1F,0x84,0xC4,0x06,0x04,0x00,
 128                0x04,0x02,0x01,0xFF,0x00,0x20,0x10,0x08,
 129                0x3F,0x42,0x41,0x40,0x40,0x40,0x70,0x00,
 130          
 131           0x10,0x0C,0x04,0x44,0x24,0x94,0x45,0x26,
 132                0x44,0x94,0x24,0x64,0x04,0x14,0x0C,0x00,
 133                0x08,0x08,0x04,0x02,0xFD,0x44,0x44,0x44,
 134                0x44,0x44,0xFD,0x02,0x04,0x0C,0x04,0x00,
 135          
 136           0x00,0x00,0x00,0x00,0xFE,0x22,0x22,0x22,
 137                0x22,0x22,0x22,0xFF,0x02,0x00,0x00,0x00,
 138                0x00,0x80,0x40,0x30,0x0F,0x02,0x02,0x02,
 139                0x02,0x42,0x82,0x7F,0x00,0x00,0x00,0x00,
 140          
 141           0x88,0x98,0x64,0x2C,0xB2,0xCD,0x00,0xFC,
 142                0x26,0x25,0x24,0x24,0x24,0xFE,0x04,0x00,
 143                0x00,0x12,0x52,0x89,0x44,0x3F,0x80,0x43,
 144                0x31,0x0F,0x01,0x3F,0x41,0x43,0x70,0x00,
 145          
 146           0x20,0x20,0x20,0x22,0x24,0x2C,0x20,0xE0,
 147                0x3F,0x20,0x20,0x20,0x20,0xF0,0x20,0x00,
 148                0x00,0x40,0x20,0x10,0x08,0x04,0x03,0x00,
 149                0x02,0x04,0x4C,0x80,0x40,0x3F,0x00,0x00,
 150          
 151           0x40,0x40,0x42,0xCC,0x00,0x20,0x10,0xFC,
 152                0x4B,0x48,0x4A,0xFC,0x48,0x4C,0x08,0x00,
 153                0x00,0x00,0x00,0x7F,0x20,0x10,0x00,0xFF,
 154                0x22,0x22,0x22,0x3F,0x22,0x32,0x20,0x00,
 155          
 156           0x10,0x10,0xF0,0x1F,0x10,0xF2,0x82,0x82,
 157                0xFE,0x82,0x82,0x82,0xFE,0x83,0x82,0x00,
 158                0x40,0x22,0x15,0x08,0x14,0x23,0x80,0x40,
 159                0x3F,0x00,0x00,0x00,0xFF,0x00,0x00,0x00 //山东师范大学传播学院赵彦彬春恨秋悲皆自扰花容月貌为谁妍
 160          
 161          };
 162          
 163          
 164          sbit DI  =P3^7;                                                          // 数据\指令 选择
 165          sbit RW  =P3^6;                                                          // 读\写 选择
 166          sbit E   =P3^5;                                                          // 读\写使能
 167          sbit CS2 =P3^4;                                                          // 片选1
 168          sbit CS1 =P3^3;                                                          // 片选2
 169          sbit RST =P3^2;                                                          // 复位
 170          
 171          
 172          
 173          
 174          
 175          /**********************************************\
 176          |*   写命令子程序                             *|
 177          |*                 *|
 178          \**********************************************/ 
 179          void write_cmd(uchar cmd)             //写命令子程序 
C51 COMPILER V7.50   LCD_DIS                                                               10/19/2007 19:17:49 PAGE 4   

 180          { RW=0;
 181   1        DI=0;                  //DI=0 写命令 
 182   1        E=1;
 183   1        P1=cmd;
 184   1        E=0;       //RW="L",E="H->L" DB7~DB0的数据被写到IR或DR 
 185   1         }
 186          
 187          /**********************************************\
 188          |*   写数据子程序                             *|
 189          
 190          |*   调用函数: null                           *|
 191          \**********************************************/ 
 192          void write_dat(uchar dat)             //写数据子程序
 193          { RW=0;
 194   1        DI=1;   //DI=1  写数据
 195   1        E=1;
 196   1        P1=dat;
 197   1        E=0;    //RW="L",E="H->L" DB7~DB0的数据被写到IR或DR 
 198   1         }
 199          
 200          /**********************************************\
 201          |*   设置显示起始行 X地址和Y地址              *|
 202          |*   入口参数:st_line 显示起始行 0~63        *| 
 203          |*             x_add   页地址  8行为一页 0~7  *|
 204          |*                 y_add   Y地址  0~128           *|
 205          
 206          \**********************************************/ 
 207          
 208          void set_dis(uchar st_line,uchar x_add,uchar y_add)  //设置显示起始行 X地址和Y地址
 209          {
 210   1      //write_cmd(st_line+0xc0);                //+0xc0是参照设置起始行的格式
 211   1       write_cmd(x_add+0xb8);                  //+0xb8是参照设置页地址的格式
 212   1        if(y_add<64) { CS1=0;CS2=1;write_cmd(y_add+0x40);} //Y_add地址实际上只有0~63 采用CS1和CS2选左右半屏
 213   1            else     { CS1=1;CS2=0;write_cmd(y_add);}      //选第一片时,+64第二片为y_add-64+64
 214   1       }
*** WARNING C280 IN LINE 208 OF LCD_DIS.C: 'st_line': unreferenced local variable
 215          
 216          
 217          
 218          /***********************************************\
 219          |*   写汉字子程序1 可以在任意位置写入          *|
 220          |*   入口参数:st_line 显示起始行 0~63         *| 
 221          |*             x_add   页地址  8行为一页 0~7   *|
 222          |*                 y_add   Y地址  0~128            *|
 223                 
 224                        count 汉字个数
 225          /*调用set_dis write_dat
 226          \***********************************************/ 
 227          void write_word(uchar st_line,uchar x_add,uchar y_add,uchar *buf,uchar count) //写入汉字
 228          { uchar i,j,k=1;
 229   1       set_dis(st_line, x_add,y_add);
 230   1       for(j=0;j<count;j++)                //显示的字数
 231   1       {
 232   2       for(i=0;i<16;i++)
 233   2         write_dat(*(buf+i+j*32)) ;        //字的下半部分,x_add+1
 234   2       set_dis(st_line,x_add+1,y_add);
 235   2       for(i=16;i<32;i++)
 236   2         write_dat(*(buf+i+j*32));         
 237   2       set_dis(st_line,x_add,y_add=y_add+16);
 238   2      
 239   2      if(y_add==128)                   //一行的字数超过8 y_add>128时换行
 240   2      {                         //为什么每次换行第一列子的上半部分出现错误?
C51 COMPILER V7.50   LCD_DIS                                                               10/19/2007 19:17:49 PAGE 5   

 241   3      
 242   3      x_add=2*k;
 243   3      
 244   3      y_add=0;
 245   3      set_dis(st_line, x_add,y_add);
 246   3      k++;
 247   3      }
 248   2      }
 249   1      
 250   1      }
 251          
 252          
 253          
 254          
 255          /****************************************************\
 256          |*   主程序入口                                     *|
 257          |*   12864LCD显示程序 proteus7.1 仿真AMPIRE128*64   *|
 258          \****************************************************/ 
 259          void main(void)                               //主程序
 260          
 261          {
 262   1      write_word(0,0,0,&dis,30);
*** WARNING C182 IN LINE 262 OF LCD_DIS.C: pointer to different objects
 263   1      
 264   1      
 265   1      
 266   1      write_cmd(0x3f); 
 267   1      CS1=CS2=1;
 268   1      while(1)
 269   1      {}
 270   1      }
 271           


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    203    ----
   CONSTANT SIZE    =   1920    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       9
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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