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

📄 12864.lst

📁 LCD12864的嵌入式C程序 很有参考价值!
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.08   12864                                                                 03/19/2005 23:08:43 PAGE 1   


C51 COMPILER V7.08, COMPILATION OF MODULE 12864
OBJECT MODULE PLACED IN .\12864.obj
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE E:\私人信件\C51\12864.C BROWSE DEBUG OBJECTEXTEND PRINT(.\12864.lst) OBJECT
                    -(.\12864.obj)

line level    source

   1          //--------------------------------------------------------------------------------
   2            //AM12864参考程序(KS0108
   3          /********************************************/
   4          /* AM12864系列测试程序 1.0 */
   5          /* Designed by Andorin LCM R&D Group */
   6          /* 2003.04.23 */
   7          /********************************************/
   8          
   9          #include <reg51.h>
  10          #include <ctype.h>
  11          #include <string.h>
  12          #include <stdlib.h>
  13          #include <stdio.h>
  14          #include <math.h>
  15          /********************************************/
  16          /* AM12864系列测试程序 1.0 */
  17          /* Designed by Andorin LCM R&D Group */
  18          /* 2003.04.23 */
  19          /********************************************/
  20          
  21          
  22          /* Define the register command code */
  23          #define Disp_On  0x3f
  24          #define Disp_Off 0x3e
  25          #define Col_Add  0x40
  26          #define Page_Add 0xb8
  27          #define Start_Line 0xc0
  28          
  29          #define Lcd_Bus P1  //MCU P1<------> LCM
  30          
  31          sbit Mcs=P3^3;  //Master chip enable
  32          sbit Scs=P3^4;  //Slave chip enable
  33          sbit Enable=P3^0; //6800 mode Enable single
  34          sbit Di=P3^5;  //Data or Instrument Select
  35          sbit RW=P3^6;  //Write or Read
  36          sbit Lcd_Rst=P3^2; //Lcm reset
  37          sbit Test_Key=P3^1;
  38          
  39          
  40          char code ce[]={
  41          /*-- 文字: 测 --*/
  42          /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
  43          0x08,0x31,0x86,0x60,0x00,0xFE,0x02,0xF2,0x02,0xFE,0x00,0xF8,0x00,0x00,0xFF,0x00, 
  44          0x04,0xFC,0x03,0x00,0x80,0x47,0x30,0x0F,0x10,0x67,0x00,0x07,0x40,0x80,0x7F,0x00
  45          };
  46          char code shi[]={
  47          /*-- 文字: 试 --*/
  48          /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
  49          0x40,0x42,0xDC,0x08,0x00,0x90,0x90,0x90,0x90,0x90,0xFF,0x10,0x12,0x1C,0x10,0x00,
  50          0x00,0x00,0x7F,0x20,0x10,0x20,0x20,0x1F,0x10,0x10,0x01,0x06,0x18,0x20,0x78,0x00
  51          };
  52          char code kai[]={
  53          /*-- 文字: 开 --*/
  54          /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
C51 COMPILER V7.08   12864                                                                 03/19/2005 23:08:43 PAGE 2   

  55          0x40,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0x00,
  56          0x00,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00
  57          };
  58          char code shi3[]={
  59          /*-- 文字: 始 --*/
  60          /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
  61          0x10,0x90,0x70,0x1F,0x12,0xF0,0x00,0x20,0x70,0x28,0x27,0x22,0x28,0x70,0x20,0x00,
  62          0x40,0x21,0x12,0x0C,0x06,0x09,0x30,0x00,0x7F,0x21,0x21,0x21,0x21,0x7F,0x00,0x00
  63          };
  64          
  65          char code wan[]={
  66          /*-- 文字: 完 --*/
  67          /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
  68          0x00,0x90,0x8C,0xA4,0xA4,0xA4,0xA5,0xA6,0xA4,0xA4,0xA4,0xA4,0x94,0x8C,0x04,0x00,
  69          0x00,0x80,0x40,0x20,0x18,0x07,0x00,0x00,0x00,0x3F,0x40,0x40,0x40,0x70,0x00,0x00
  70          };
  71          char code bi[]={
  72          /*-- 文字: 毕 --*/
  73          /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
  74          0x00,0x00,0xFF,0x88,0x48,0x28,0x08,0x80,0x7F,0x88,0x88,0x88,0x84,0x84,0xE0,0x00,
  75          0x04,0x04,0x04,0x04,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00
  76          };
  77          
  78          
  79          /* AM12864B系列测试首页显示内容 */
  80          /*****************/
  81          /* ANDORIN */
  82          /* 安的利光电科技*/
  83          /* AM12864 */
  84          /* 测试程序 1.0 */
  85          /*****************/
  86          
  87          unsigned char code FirstPage[]={
  88          /*-- 调入了一幅图像:\\Andorin-server\开发部\arin\12864.bmp --*/
  89          /*-- 宽度x高度=128x64 --*/
  90          0x00,0x00,0x00,0x80,0xF0,0xFE,0x7E,0x0E,0x7E,0xFE,0xF0,0x80,0x00,0x00,0x00,0x00,
  91          0xFE,0xFE,0xFE,0x3C,0xF0,0xE0,0x80,0x00,0x00,0xFE,0xFE,0xFE,0x00,0x00,0x00,0xFE,
  92          0xFE,0xFE,0x0E,0x0E,0x0E,0x0E,0x0E,0x3E,0xFC,0xF8,0xE0,0x00,0x00,0xE0,0xF8,0xFC,
  93          0x3C,0x1E,0x0E,0x0E,0x0E,0x0E,0x1E,0x3C,0xFC,0xF8,0xE0,0x00,0x00,0x00,0xFE,0xFE,
  94          0xFE,0x8E,0x8E,0x8E,0x8E,0x8E,0xFE,0xFC,0xF8,0x00,0x00,0x00,0xFE,0xFE,0xFE,0x00,
  95          0x00,0xFE,0xFE,0xFE,0x3C,0xF0,0xE0,0x80,0x00,0x00,0xFE,0xFE,0xFE,0x00,0x00,0x00,
  96          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  97          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  98          0x80,0xF0,0xFE,0x7F,0x1F,0x1D,0x1C,0x1C,0x1C,0x1D,0x1F,0x7F,0xFE,0xF0,0x80,0x00,
  99          0xFF,0xFF,0xFF,0x00,0x00,0x03,0x0F,0x3E,0x78,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,
 100          0xFF,0xFF,0xE0,0xE0,0xE0,0xE0,0xE0,0x70,0x7F,0x3F,0x0F,0x00,0x00,0x0F,0x3F,0x7F,
 101          0x78,0xF0,0xE0,0xE0,0xE0,0xE0,0xF0,0x78,0x7F,0x3F,0x0F,0x00,0x00,0x00,0xFF,0xFF,
 102          0xFF,0x03,0x03,0x03,0x0F,0x1F,0x7D,0xF9,0xE0,0x80,0x00,0x00,0xFF,0xFF,0xFF,0x00,
 103          0x00,0xFF,0xFF,0xFF,0x00,0x00,0x03,0x0F,0x3E,0x78,0xFF,0xFF,0xFF,0x00,0x00,0x00,
 104          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 105          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 106          0x00,0x00,0x00,0x40,0x30,0x10,0x10,0x10,0xD0,0x12,0x1C,0x10,0x10,0x10,0x10,0x50,
 107          0x30,0x00,0x00,0x00,0x00,0xF0,0x10,0x18,0x16,0x10,0xF0,0x80,0x40,0x30,0x1E,0x10,
 108          0x10,0x10,0xF8,0x10,0x00,0x00,0x40,0x48,0x48,0x48,0xC8,0xF8,0x44,0x46,0x44,0x40,
 109          0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x60,0x00,0x00,
 110          0xFE,0x00,0x80,0x60,0x18,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0xF0,0x10,0x10,0x10,
 111          0x10,0xFE,0x10,0x10,0x10,0x10,0x10,0xF8,0x10,0x00,0x00,0x00,0x48,0x48,0x48,0x44,
 112          0xFC,0x42,0x42,0x40,0x80,0x08,0x30,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x20,0x20,
 113          0x20,0xFE,0x20,0x20,0x00,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x30,0x20,0x00,0x00,
 114          0x00,0x00,0x01,0x01,0x01,0x01,0x09,0x8F,0x91,0x51,0x21,0x21,0x59,0x47,0x81,0x81,
 115          0x81,0x01,0x00,0x00,0x00,0xFF,0x42,0x42,0x42,0x42,0xFF,0x00,0x00,0x01,0x0E,0x80,
 116          0x00,0x80,0x7F,0x00,0x00,0x00,0x20,0x10,0x08,0x06,0x01,0xFF,0x01,0x02,0x0C,0x00,
C51 COMPILER V7.08   12864                                                                 03/19/2005 23:08:43 PAGE 3   

 117          0x00,0x1F,0x80,0x00,0xFF,0x00,0x00,0x00,0x01,0x01,0x01,0x81,0x41,0x3F,0x01,0x01,
 118          0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0xF1,0x00,0x00,0x00,0x00,0x1F,0x09,0x09,0x09,
 119          0x09,0xFF,0x09,0x09,0x09,0x09,0x09,0x1F,0xC0,0x00,0x00,0x00,0x10,0x08,0x04,0x03,
 120          0xFF,0x01,0x06,0x10,0x10,0x13,0x08,0x08,0x08,0xFF,0x04,0x04,0x00,0x00,0x04,0x84,
 121          0x02,0xFF,0x01,0x01,0x00,0x81,0x87,0x59,0x21,0x51,0x4D,0x83,0x81,0x80,0x00,0x00,
 122          0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 123          0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x80,0xF1,0x7C,0x0C,0x7C,0xF0,0x80,
 124          0x01,0x00,0x00,0xFC,0xFC,0x3C,0xF8,0xC0,0x00,0x00,0x00,0xC1,0xF8,0x3C,0xFC,0xFC,
 125          0x00,0x00,0x00,0x61,0x30,0x18,0xFC,0xFC,0x01,0x01,0x01,0x00,0x30,0x38,0x1C,0x0C,
 126          0x0C,0x1C,0xF9,0xF1,0x01,0x01,0x71,0xF9,0x8C,0x8C,0x8C,0x8C,0xF8,0x70,0x00,0x00,
 127          0xE0,0xF8,0x1D,0x8D,0x8D,0x8D,0x19,0x11,0x01,0x00,0x00,0xC0,0xE0,0x38,0xFC,0xFC,
 128          0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
 129          0x01,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
 130          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 131          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x7C,0x1F,0x07,0x06,0x06,0x06,0x07,0x1F,
 132          0x7C,0x60,0x00,0x7F,0x7F,0x00,0x01,0x1F,0x7C,0x60,0x7C,0x1F,0x01,0x00,0x7F,0x7F,
 133          0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x7F,0x00,0x00,0x00,0x00,0x60,0x70,0x78,0x6C,
 134          0x66,0x63,0x61,0x60,0x00,0x00,0x1E,0x3F,0x61,0x61,0x61,0x61,0x3F,0x1E,0x00,0x00,
 135          0x0F,0x3F,0x73,0x61,0x61,0x61,0x3F,0x1E,0x00,0x0E,0x0F,0x0D,0x0C,0x0C,0x7F,0x7F,
 136          0x0C,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 137          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 138          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x61,0x06,0xC0,
 139          0x00,0xFE,0x02,0xF2,0x02,0xFE,0x00,0x00,0xF8,0x00,0xFF,0x00,0x00,0x00,0x80,0x82,
 140          0x84,0x8C,0x00,0x10,0x90,0x90,0x90,0x90,0x90,0xFF,0x10,0x12,0x14,0x10,0x00,0x00,
 141          0x24,0x24,0xA4,0xFE,0xA2,0x23,0x22,0x80,0xBE,0xA2,0xA2,0xA2,0xA2,0xA2,0xBF,0x82,
 142          0x00,0x00,0x00,0x00,0xFC,0x04,0x14,0x14,0x14,0x15,0x56,0x94,0x54,0x34,0x14,0x14,
 143          0x06,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x30,0x18,0xFC,0xFC,0x00,
 144          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xF8,0x1C,0x0C,0x0C,0x1C,0xF8,0xF0,
 145          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 146          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x7E,0x81,
 147          0x40,0x27,0x10,0x0F,0x10,0x67,0x00,0x00,0x4F,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,
 148          0x00,0x7F,0x20,0x10,0x20,0x60,0x3F,0x10,0x10,0x03,0x1C,0x20,0x40,0xF0,0x00,0x00,
 149          0x10,0x0E,0x01,0xFF,0x00,0x03,0x80,0x88,0x88,0x88,0x88,0xFF,0x88,0x88,0x88,0xC8,
 150          0x80,0x00,0x80,0x60,0x1F,0x00,0x01,0x01,0x01,0x41,0x81,0x7F,0x01,0x01,0x01,0x05,
 151          0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x7F,0x00,
 152          0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x1F,0x3F,0x70,0x60,0x60,0x70,0x3F,0x1F,
 153          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
 154          };
 155          
 156          /*------------------延时子程序-----------------------------*/
 157          void delay(unsigned int t)
 158          {
 159   1      unsigned int i,j;
 160   1      for(i=0;i<t;i++)
 161   1      for(j=0;j<10;j++)
 162   1      ;
 163   1      }
 164          
 165          /*------------------写命令到LCD------------------------------*/
 166          void write_com(unsigned char cmdcode)
 167          {
 168   1      
 169   1      Di=0;
 170   1      RW=0;
 171   1      
 172   1      Lcd_Bus=cmdcode;
 173   1      delay(0);
 174   1      Enable=1;
 175   1      delay(0);
 176   1      Enable=0;
 177   1      }
 178          
C51 COMPILER V7.08   12864                                                                 03/19/2005 23:08:43 PAGE 4   

 179          /*-------------------写数据到LCD----------------------------*/
 180          
 181          void write_data(unsigned char Dispdata)
 182          {
 183   1      
 184   1      Di=1;
 185   1      RW=0;
 186   1      
 187   1      Lcd_Bus=Dispdata;
 188   1      delay(0);
 189   1      Enable=1;
 190   1      delay(0);
 191   1      Enable=0;
 192   1      }
 193          
 194          /*-------------------读LCD数据----------------------------*/
 195          
 196          unsigned char read_data()
 197          {
 198   1      unsigned char tmpin;
 199   1      
 200   1      Di=1;
 201   1      RW=1;
 202   1      delay(0);
 203   1      Enable=1;
 204   1      delay(0);
 205   1      Enable=0;
 206   1      
 207   1      tmpin=Lcd_Bus;
 208   1      
 209   1      return tmpin;
 210   1      }
 211          
 212          
 213          
 214          /*------------------显示边框-------------------------------*/
 215          void frame()
 216          {
 217   1      unsigned char i;
 218   1      Mcs=1;
 219   1      Scs=1;
 220   1      write_com(Page_Add+0);
 221   1      write_com(Col_Add+0);
 222   1      for(i=0;i<64;i++) write_data(0x01);
 223   1      write_com(Page_Add+7);

⌨️ 快捷键说明

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