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

📄 main.lst

📁 Nokia3310 LCD 51系列单片机控制源代码
💻 LST
字号:
C51 COMPILER V7.09   MAIN                                                                  03/29/2007 11:47:52 PAGE 1   


C51 COMPILER V7.09, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include "SST89E564RD.H"
   2          
   3          #define  uchar  unsigned char
   4          #define  uint   unsigned int
   5          
   6          
   7          /*---------------------------------------------
   8          void delay(int t)
   9          {
  10              TR0=0;
  11              TMOD=TMOD&0xf1;
  12              TMOD=TMOD|0x01;
  13              TH0=0xf8;TL0=0xcc;
  14              TR0=1;
  15              for(;t>0;t--)
  16              {
  17                  while(!TF0){};
  18                  TF0=0;
  19                  TR0=0;
  20                  TH0=0xf8;TL0=0xcc;
  21                  TR0=1;
  22              }
  23          }
  24          
  25          
  26          void main(void)  
  27          {
  28          
  29             while(1)
  30          
  31             {
  32                P0=~P0;
  33                    delay(10);      
  34             }
  35          }
  36          ----------------------------------------------*/
  37          
  38          /*            3310液晶显示屏C51测试程序
  39                           2004/07/31/BD2YA
  40          接脚资料:
  41          Pin Signal Description Port
  42          1:VDD
  43          Power Input. Logic supply voltage range VDD to GND : 2.7 to 3.3 V
  44          2:SCLK
  45          Serial clock. Input for the clock signal: 0.0 to 4.0 Mbits/s.
  46          3:SDIN
  47          Serial data. Input for the data line.
  48          4:D/C
  49          Mode Select. To select either command/address or data input.
  50          5:SCE
  51          Chip enable input. The enable pin allows data to be clocked in. The signal is active LOW.
  52          6:GND
  53          Ground
  54          7:VOUT
  55          Ouptut voltage. Add external 1-10 uF electrolytic capacitor from VOUT to GND
C51 COMPILER V7.09   MAIN                                                                  03/29/2007 11:47:52 PAGE 2   

  56          8:RES
  57          External reset. This signal will reset the device and must be applied to properly
  58          initialize the chip. The signal is active LOW.
  59          控制芯片:
  60          PCD8544  */
  61          
  62           
  63          
  64          
  65          //#include <reg51.h>
  66          //#define uchar unsigned char
  67          //#define uint unsigned int   
  68          sbit sdin = P0^1; //数据
  69          sbit sclk = P0^0;//时钟
  70          sbit dc   = P0^2;//1写数据,0写指令
  71          sbit sce  = P0^4;//片选
  72          sbit res  = P0^3;//复位,0复位
  73          
  74          /*void write_byte(uchar dd,bit a)//写一字节
  75          {
  76           char i;
  77             sce=0;
  78             dc=a;
  79             for(i=7;i>=0;i--)
  80              {   
  81            sdin=(dd>>i)&1;
  82               sclk=0;
  83               sclk=1;   
  84               }
  85             dc=1;
  86            sce=1;
  87          sdin=1;
  88          }*/
  89          
  90          
  91          //---------------------超快多135字-----------------------------
  92          
  93          unsigned char mask_table[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
  94          
  95          void write_byte(uchar dd,bit a)//写一字节
  96          {
  97   1      char i;
  98   1         sce=0;
  99   1         dc=a;
 100   1         for(i=0;i<8;i++)
 101   1          { 
 102   2          if(dd&mask_table[i])
 103   2           sdin=1;
 104   2           else
 105   2        sdin=0;
 106   2           sclk=0;    
 107   2           sclk=1;   
 108   2           }
 109   1         dc=1;
 110   1        sce=1;
 111   1      sdin=1;
 112   1      }
 113          
 114          
 115          void setadd(unsigned char a,unsigned char d)//设定地址
 116          {
 117   1        write_byte((d|0x40),0);
C51 COMPILER V7.09   MAIN                                                                  03/29/2007 11:47:52 PAGE 3   

 118   1              write_byte((a|0x80),0);
 119   1      }
 120          
 121          void qp()//清屏
 122          {
 123   1      uchar t;
 124   1      uchar k;
 125   1      uint d;
 126   1      d=0;
 127   1      for(t=0;t<6;t++)
 128   1      {  
 129   2            for(k=0;k<84;k++)
 130   2            {      
 131   3             write_byte(0,1);
 132   3             d=d+1;      
 133   3            }
 134   2           }
 135   1      }
 136          
 137          
 138          uchar code map2[]=
 139          {
 140          /*--  宽度x高度=84x48---------*/
 141          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 142          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 143          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 144          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 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,0x00,0x00,0x00,0x00,
 147          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0xA0,0x00,0xD0,0x50,0xF0,0x50,
 148          0x50,0xF0,0x50,0xD0,0x00,0x40,0x40,0x40,0xC0,0x50,0x60,0x40,0xC0,0x40,0x60,0x40,
 149          0x00,0x00,0x00,0xE0,0x20,0x20,0x20,0xD0,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
 150          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 151          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 152          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x10,
 153          0x11,0x1F,0x15,0x15,0x75,0x15,0x1F,0x11,0x00,0x40,0x40,0x40,0x23,0x2C,0x10,0x2C,
 154          0x23,0x40,0x40,0x40,0x00,0x20,0x13,0x0A,0x06,0x42,0x42,0x7F,0x06,0x0A,0x13,0x22,
 155          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 156          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 157          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 158          0x00,0x20,0x60,0x80,0x60,0x20,0x00,0x20,0x60,0x80,0x60,0x20,0x00,0x20,0x60,0x80,
 159          0x60,0x20,0x00,0x20,0x60,0x80,0x60,0x20,0x00,0x20,0x60,0x80,0x60,0x20,0x00,0x20,
 160          0x60,0x80,0x60,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 161          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 162          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 163          0x00,0x00,0x00,0x00,0x00,0x02,0x03,0x00,0x03,0x02,0x00,0x02,0x03,0x00,0x03,0x02,
 164          0x00,0x02,0x03,0x00,0x03,0x02,0x00,0x02,0x03,0x00,0x03,0x02,0x00,0x02,0x03,0x00,
 165          0x03,0x02,0x00,0x02,0x03,0x00,0x03,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 166          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 167          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 168          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 169          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 170          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 171          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 172          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 173          
 174          };
 175          
 176          uchar code map1[]=
 177          {
 178          /*------------------------------------------------------------------------------
 179          ;  源文件 / 文字 : E:\3310\1\qq.bmp模
C51 COMPILER V7.09   MAIN                                                                  03/29/2007 11:47:52 PAGE 4   

 180          ;  宽×高(像素): 84×48
 181          ;  字模格式/大小 : 单色点阵液晶字模,纵向取模,字节倒序/504字节
 182          ;  数据转换日期  : 2004-7-30 13:40:24*/
 183          0x00,0x00,0x02,0xFA,0x8A,0x8A,0x8A,0xFA,0x02,0x02,0xFE,0x03,0x02,0x00,0x40,0x4F,
 184          0xC9,0x79,0x49,0xCF,0x00,0xFC,0x00,0x00,0xFF,0x00,0x02,0x82,0x02,0xBE,0x22,0x63,
 185          0xA2,0x22,0x22,0xA2,0x02,0x00,0x00,0x01,0x01,0x01,0x01,0xF9,0x09,0x05,0x03,0x01,
 186          0x00,0x00,0x10,0x14,0x14,0x94,0xD4,0xBF,0x94,0x5C,0x54,0x12,0x10,0x00,0x00,0xFF,
 187          0x29,0x29,0xFF,0x00,0xFF,0x29,0x29,0xFF,0x00,0x00,0x04,0x04,0x04,0xC4,0x3F,0xD4,
 188          0x14,0x94,0x74,0x06,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x04,0x04,0x07,0x00,
 189          0x00,0x00,0x04,0x02,0x01,0x04,0x04,0x03,0x00,0x01,0x04,0x04,0x07,0x00,0x02,0x01,
 190          0x00,0x07,0x04,0x04,0x05,0x04,0x06,0x00,0x03,0x00,0x00,0x80,0x40,0x44,0x84,0x07,
 191          0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x92,0x51,0x30,0x37,0x14,0x14,0x14,0x04,0x07,
 192          0x00,0x00,0x26,0x21,0x44,0x84,0x07,0x02,0x01,0x04,0x04,0x07,0x00,0x00,0x04,0x02,
 193          0x05,0x04,0x04,0x02,0x01,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 194          0x30,0x48,0x88,0x10,0x60,0x78,0x04,0x04,0xF8,0x00,0x00,0x00,0x00,0x00,0x1C,0xE2,
 195          0x02,0x04,0x08,0x04,0x84,0x84,0x82,0x02,0x02,0x02,0x01,0x81,0x41,0x21,0x21,0x20,
 196          0x00,0x04,0x07,0x18,0x60,0x80,0x00,0x00,0xF0,0x0C,0x03,0x00,0xFC,0x00,0x00,0x04,
 197          0x0E,0x04,0xC0,0x60,0x62,0x37,0x12,0x90,0x16,0x19,0x7A,0xFC,0xF8,0xF0,0x80,0x40,
 198          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 199          0x00,0x00,0x00,0x00,0x00,0x07,0x08,0x10,0xE0,0x00,0x00,0x00,0xF8,0x07,0x00,0x00,
 200          0x02,0x12,0x12,0x1F,0xF4,0xA0,0x00,0x00,0x00,0x40,0x80,0x81,0x8C,0x5C,0x3C,0x2C,
 201          0x40,0x40,0x40,0x20,0x00,0x00,0x80,0xC0,0x64,0x5F,0x45,0xC9,0x83,0x04,0x04,0x04,
 202          0x1B,0x20,0x40,0x80,0x80,0x01,0x00,0x00,0x00,0x00,0x10,0x14,0x23,0x21,0xA1,0x51,
 203          0xF1,0x3F,0x12,0xE2,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 204          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0C,0x10,0x20,
 205          0x21,0x22,0x22,0x22,0x7F,0x41,0x41,0x47,0x49,0xCB,0x0F,0x06,0x06,0x04,0x0C,0x1C,
 206          0x14,0x34,0x24,0x24,0x14,0x14,0x12,0x0A,0x06,0x01,0x00,0x00,0x00,0x00,0xE0,0x20,
 207          0x2F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
 208          0x01,0x01,0x00,0x00,0xF8,0x21,0x21,0x40,0x40,0x20,0xD1,0x8A,0x0C,0x10,0x20,0xC0,
 209          0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,
 210          0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x1F,0x20,
 211          0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,
 212          0x00,0x20,0x07,0x38,0x00,0x3F,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,
 213          0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x07,0x38,0x04,0x22,0x01,0x31,0x10,0x28,
 214          0x08,0x24,0x04,0x23,0x00,0x20,0x00,0x20
 215          };
 216          
 217          void xp(uchar *map)//写一屏图
 218          {
 219   1      uchar e;
 220   1      uchar t;
 221   1      uchar k;
 222   1      uint d;
 223   1         d=0;
 224   1         for(t=0;t<6;t++)
 225   1          {  
 226   2            for(k=0;k<84;k++)
 227   2            {
 228   3              e=*map;     
 229   3              write_byte(e,1);
 230   3              map++;      
 231   3            } 
 232   2          } 
 233   1      }
 234          
 235          void main(void)//主程序
 236          {
 237   1        uint t; 
 238   1        res=0;res=0;res=0;
 239   1        res=1;
 240   1        sce=1;
 241   1        sdin=1;
C51 COMPILER V7.09   MAIN                                                                  03/29/2007 11:47:52 PAGE 5   

 242   1        sclk=1;
 243   1        write_byte(0x21,0);//初始化Lcd,功能设定使用扩充指令
 244   1        write_byte(0xd3,0);//设定液晶偏置电压(高--低)
 245   1        write_byte(0x20,0);//使用基本指令
 246   1        write_byte(0x0C,0);//设定显示模式,正常显示
 247   1      
 248   1        while(1)
 249   1        {
 250   2         qp();//清屏
 251   2         for(t=0;t<30000;t++);//延时
 252   2         xp(map1); 
 253   2         for(t=0;t<30000;t++);//延时
 254   2         qp();//清屏
 255   2         for(t=0;t<30000;t++);//延时
 256   2         xp(map2); 
 257   2         for(t=0;t<30000;t++);//延时
 258   2        }
 259   1      }
 260          
 261          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    246    ----
   CONSTANT SIZE    =   1008    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      8       3
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----       1
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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