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

📄 tree.lst

📁 LCD12864做的显示函数
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V8.02   TREE                                                                  03/26/2009 20:55:54 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE TREE
OBJECT MODULE PLACED IN tree.OBJ
COMPILER INVOKED BY: D:\KeilC51\Keil_c51_v802\C51\BIN\C51.EXE tree.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include<reg52.h>
   2          #define uc unsigned char
   3          #define ui unsigned int
   4          
   5          sbit E=P3^4;             
   6          sbit RW=P0^2;            //读写控制
   7          sbit RS=P0^3;            //数据 指令选择
   8          sbit L=P0^1;             //左屏
   9          sbit R=P0^0;             //右屏
  10          sbit Busy=P2^7;
  11          uc i,j,licheng_ge=0,licheng_shi=0,licheng_bai=0,licheng_qian=0;
  12          float dj=3.5,zj,lc;
  13          
  14           const uc code HZ[][32] = {
  15                    
  16                    0x00,0x00,0xF8,0x49,0x4A,0x4C,0x48,0xF8,// 单
  17                    0x48,0x4C,0x4A,0x49,0xFC,0x08,0x00,0x00,
  18                    0x10,0x10,0x17,0x12,0x12,0x12,0x12,0xFF,
  19                    0x12,0x12,0x12,0x12,0x13,0x18,0x10,0x00,
  20          
  21                0x80,0x40,0x20,0xF8,0x87,0x40,0x20,0x90,// 价
  22                    0x08,0x07,0x08,0x90,0x20,0xC0,0x40,0x00,
  23                    0x00,0x00,0x00,0xFF,0x00,0x80,0x40,0x3F,
  24                    0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,
  25          
  26                    0x00,0x00,0xFE,0x12,0x12,0x12,0x12,0xFE,// 里
  27                0x12,0x12,0x12,0x12,0xFF,0x02,0x00,0x00,
  28                    0x40,0x48,0x49,0x49,0x49,0x49,0x49,0x7F,
  29                    0x49,0x49,0x49,0x49,0x4D,0x68,0x40,0x00,
  30                    
  31                    0x10,0x12,0xD2,0xFE,0x91,0x11,0x80,0xBF,// 程
  32                    0xA1,0xA1,0xA1,0xA1,0xBF,0x80,0x00,0x00,
  33                0x04,0x03,0x00,0xFF,0x00,0x41,0x44,0x44,
  34                    0x44,0x7F,0x44,0x44,0x44,0x44,0x40,0x00,
  35          
  36                    0x00,0x00,0x00,0xF8,0x89,0x8E,0x88,0x88,//总
  37                    0x88,0x8C,0x8B,0xF8,0x00,0x00,0x00,0x00,
  38                0x00,0x20,0x38,0x00,0x3C,0x40,0x40,0x42,
  39                    0x4C,0x40,0x40,0x70,0x04,0x18,0x30,0x00,
  40          
  41                    0x40,0x20,0xF0,0x1C,0x47,0x22,0x10,0xC8,//价
  42                    0x04,0x03,0x04,0xD8,0x30,0x60,0x20,0x00,
  43                0x00,0x00,0xFF,0x00,0x80,0x60,0x18,0x07,
  44                    0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,
  45          
  46                    0x00,0xFC,0x84,0x84,0x84,0xFE,0x14,0x10,//时
  47                    0x90,0x10,0x10,0x10,0xFF,0x10,0x10,0x00,
  48                    0x00,0x3F,0x10,0x10,0x10,0x3F,0x00,0x00,
  49                    0x00,0x23,0x40,0x80,0x7F,0x00,0x00,0x00,
  50               
  51                    0x00,0xF8,0x01,0x02,0xF6,0x10,0x12,0x12,//间
  52                    0x12,0x12,0xFA,0x12,0x02,0xFF,0x02,0x00,
  53                    0x00,0xFF,0x00,0x00,0x3F,0x11,0x11,0x11,
  54                    0x11,0x11,0x3F,0x40,0x80,0x7F,0x00,0x00,
  55                    
C51 COMPILER V8.02   TREE                                                                  03/26/2009 20:55:54 PAGE 2   

  56                    0x00,0x20,0x20,0x22,0x22,0xE2,0x22,0x22,//元
  57                    0x22,0xE2,0x22,0x22,0x22,0x20,0x20,0x00,
  58                0x00,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,
  59                    0x00,0x3F,0x40,0x40,0x40,0x40,0x70,0x00,
  60          
  61                    0x14,0x24,0x44,0x84,0x64,0x1C,0x20,0x18,//欢
  62                    0x0F,0xE8,0x08,0x08,0x28,0x18,0x08,0x00,
  63                0x20,0x10,0x4C,0x43,0x43,0x2C,0x20,0x10,
  64                    0x0C,0x03,0x06,0x18,0x30,0x60,0x20,0x00,
  65          
  66                    0x40,0x41,0xCE,0x04,0x00,0xFC,0x04,0x02,//迎
  67                    0x02,0xFC,0x04,0x04,0x04,0xFC,0x00,0x00,
  68                0x40,0x20,0x1F,0x20,0x40,0x47,0x42,0x41,
  69                    0x40,0x5F,0x40,0x42,0x44,0x43,0x40,0x00,
  70          
  71                    0x08,0x28,0x2A,0x2A,0xFA,0x0A,0x0A,0xFE,//乘
  72                    0x0A,0x09,0xF9,0x49,0x29,0x2C,0x88,0x00,
  73                0x22,0x22,0x11,0x11,0x0B,0x0C,0x06,0x7F,
  74                    0x02,0x04,0x0D,0x19,0x31,0x11,0x01,0x00,
  75          
  76                    0x00,0x80,0x60,0x1C,0x20,0xC0,0x00,0xFF,//坐
  77                    0x00,0x80,0x40,0x3C,0x40,0x80,0x00,0x00,
  78                0x41,0x40,0x44,0x44,0x44,0x44,0x44,0x7F,
  79                    0x45,0x44,0x44,0x44,0x44,0x40,0x40,0x00,
  80                     };
  81          
  82          
  83                           
  84          
  85            const uc code FH[][16] = {                                     //符号
  86          
  87                0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00, //:
  88                    0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,
  89          
  90                    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//.
  91                    0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,
  92          
  93                    0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,//k
  94                    0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,
  95          
  96                    0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, //m
  97                    0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,
  98          
  99          
 100                                                    };
 101          
 102            const uc code SZ[][16]= {                                      //数字 ;
 103                0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,//0
 104                    0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00, 
 105          
 106                    0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,//1
 107                    0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,
 108          
 109                    0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,//2
 110                    0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,
 111          
 112                    0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,//3
 113                    0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00, 
 114          
 115                    0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,//4
 116                    0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,
 117                    
C51 COMPILER V8.02   TREE                                                                  03/26/2009 20:55:54 PAGE 3   

 118                    0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,//5
 119                    0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00, 
 120                    
 121                    0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,//6
 122                    0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,
 123                    
 124                    0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,//7
 125                    0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00, 
 126                    
 127                    0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,//8
 128                    0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,
 129          
 130          
 131                    0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00//9
 132                    ,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,
 133                                             
 134                                                                   };
 135          
 136          void iniLCD(void);        //函数声明
 137          void chkbusy(void);
 138          void wcode(uc);
 139          void wdata(uc);
 140          void display_HZ(uc,uc,uc *);
 141          void SetOnOff(uc onoff);
 142          
 143          void delay(uc a)
 144                  {
 145   1              uc i;
 146   1              while(a--)
 147   1                      for(i=100;i>0;i--)
 148   1                              ;
 149   1              }
 150          
 151          
 152          void SendCommand(uc command)
 153            {
 154   1              chkbusy();
 155   1              E = 1;
 156   1              RW = 0;
 157   1              RS = 0;
 158   1              P2 = command;
 159   1              E = 0;
 160   1        }
 161          
 162          
 163          void SetOnOff(uc onoff) //1-开显示 0-关
 164             {
 165   1             if(onoff == 1)
 166   1             {chkbusy();E=1;RW=0;RS=0;P2=0x3f;E=0;}  //0011 111x
 167   1             else
 168   1             P2=0x3e;
 169   1          }
 170          
 171          
 172          void SetLine(uc line)  //line -> 0 : 7
 173           {
 174   1       line = line & 0x07;
 175   1       line = line | 0xb8;   //1011 1xxx
 176   1       SendCommand(line);
 177   1       }
 178          
 179          
C51 COMPILER V8.02   TREE                                                                  03/26/2009 20:55:54 PAGE 4   

 180          void SetColum(uc colum) //colum -> 0 :63
 181           {
 182   1       colum = colum & 0x3f;
 183   1       colum = colum | 0x40;  //01xx xxxx
 184   1       SendCommand(colum);
 185   1       }
 186          
 187          
 188          void SelectScreen(uc screen) //0-全屏,1—左屏,2-右屏
 189           {
 190   1              switch(screen)
 191   1                      {
 192   2                              case 0 :
 193   2                              L = 0;
 194   2                              delay(2);
 195   2                              R = 1;
 196   2                              delay(2);
 197   2                              break;
 198   2                              case 1 :
 199   2                              L = 1;
 200   2                              delay(2);
 201   2                              R = 0;
 202   2                              delay(2);
 203   2                              break;
 204   2                              case 2 :
 205   2                              L = 0;
 206   2                              delay(2);
 207   2                              R = 0;
 208   2                              delay(2);
 209   2                              break;
 210   2                      }
 211   1              }
 212          
 213          
 214          void ClearScreen(uc screen)  // 清屏 点亮背光 2-全屏,0—左屏,1-右屏
 215            {
 216   1       uc i,j;
 217   1       SelectScreen(screen);
 218   1       for(i = 0;i < 8;i ++)
 219   1       {
 220   2        SetLine(i);
 221   2        SetColum(0);
 222   2        for(j = 0;j < 64; j ++)
 223   2         wdata(0x00);
 224   2        }
 225   1       }
 226          
 227          
 228          
 229          void iniLCD(void)
 230          {
 231   1              wcode(0x3f);      //开显示设置
 232   1              wcode(0xc0);      //设置显示起始行为第一行
 233   1              wcode(0xb8);      //页面地址设置
 234   1              wcode(0x40);      //列地址设为0
 235   1              L=1;R=1;
 236   1              SetOnOff(1);      //开显示
 237   1              ClearScreen(2);   //清屏,点亮背光
 238   1              
 239   1      }
 240          
 241          

⌨️ 快捷键说明

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