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

📄 130x130_demo.lst

📁 51单片机做得彩屏显示
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V8.02   130X130_DEMO                                                          04/30/2009 10:56:55 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE 130X130_DEMO
OBJECT MODULE PLACED IN 130x130_demo.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE 130x130_demo.c ROM(SMALL) BROWSE DEBUG OBJECTEXTEND

line level    source

   1          //www.mcufz.com      www.mcufz.com/bbs
   2          #include <reg52.h>
   3          sbit LcdRST  = P2^0; 
   4          sbit LcdCS   = P2^1; 
   5          sbit sdata  = P2^2;
   6          sbit sclk   = P2^3;
   7          sbit c_d    = P2^4;
   8          unsigned char code bmp130130[17424];
   9          
  10          void Delay_nms(unsigned int MS)
  11          {
  12   1           unsigned char us,usn;
  13   1           while(MS!=0)            //for 12M
  14   1            { 
  15   2               usn = 2;
  16   2               while(usn!=0)
  17   2                {
  18   3                  us = 0xf5;
  19   3                  while (us!=0)
  20   3                   {
  21   4                     us--;
  22   4                   };
  23   3                  usn--;
  24   3                 }
  25   2               MS--;
  26   2            }
  27   1      }
  28          //www.mcufz.com      www.mcufz.com/bbs 
  29           void write_data(unsigned char dat)
  30           {
  31   1              unsigned char i;
  32   1                 c_d =1;
  33   1                     LcdCS=0;
  34   1           for(i=0;i<8;i++)
  35   1           {
  36   2                 sclk = 0;
  37   2                 dat=dat<<1;
  38   2                 sdata = CY;
  39   2                 sclk = 1;
  40   2                 sclk = 0;
  41   2           }
  42   1      
  43   1              LcdCS=1;
  44   1       
  45   1       }
  46          //www.mcufz.com      www.mcufz.com/bbs
  47           void write_data16(unsigned char datH,unsigned char datL)
  48          
  49           {
  50   1               unsigned char i;
  51   1                 c_d =1;
  52   1                     LcdCS=0;
  53   1           for(i=0;i<8;i++)
  54   1           {
  55   2                 sclk = 0;
C51 COMPILER V8.02   130X130_DEMO                                                          04/30/2009 10:56:55 PAGE 2   

  56   2                 datH=datH<<1;
  57   2                 sdata = CY;
  58   2                 sclk = 1;
  59   2                 sclk = 0;
  60   2           }
  61   1           for(i=0;i<8;i++)
  62   1           {
  63   2                 sclk = 0;
  64   2                 datL=datL<<1;
  65   2                 sdata = CY;
  66   2                 sclk = 1;
  67   2                 sclk = 0;
  68   2           }
  69   1              LcdCS=1;
  70   1      
  71   1       }
  72          
  73          
  74          //www.mcufz.com      www.mcufz.com/bbs
  75           void write_cmd(unsigned char dat)
  76           {
  77   1      unsigned char i;
  78   1                 c_d =0;
  79   1                 LcdCS=0;
  80   1      
  81   1           for(i=0;i<8;i++)
  82   1           {
  83   2                 sclk = 0;
  84   2                 dat=dat<<1;
  85   2                 sdata = CY;
  86   2                 sclk = 1;
  87   2                 sclk = 0;
  88   2           }
  89   1      
  90   1              LcdCS=1;
  91   1        
  92   1       }
  93           
  94           
  95           
  96          //www.mcufz.com      www.mcufz.com/bbs 
  97           //
  98           void main(void)
  99           {
 100   1        unsigned int i;
 101   1        LcdCS=1;
 102   1        sclk=0;
 103   1        LcdRST=1;
 104   1        Delay_nms(100);
 105   1        LcdRST=0;
 106   1        Delay_nms(5);
 107   1        LcdRST=1;
 108   1        Delay_nms(100);
 109   1               write_cmd(0x10);
 110   1               write_data16(0x2f,0x8e);
 111   1      
 112   1               write_cmd(0x11);
 113   1               write_data16(0x00,0x0c);
 114   1       
 115   1       
 116   1               write_cmd(0x07);
 117   1               write_data16(0x00,0x21);
C51 COMPILER V8.02   130X130_DEMO                                                          04/30/2009 10:56:55 PAGE 3   

 118   1       
 119   1               write_cmd(0x28);
 120   1               write_data16(0x00,0x06);
 121   1      
 122   1               write_cmd(0x28);
 123   1               write_data16(0x00,0x05);
 124   1                      
 125   1                      
 126   1               write_cmd(0x27);
 127   1               write_data16(0x05,0x7f);
 128   1                      
 129   1               write_cmd(0x29);
 130   1               write_data16(0x89,0xa1);                               
 131   1                      
 132   1                       write_cmd(0x00);           //write index, 16bits, high 8 bits is 0x00
 133   1               write_data16(0x00,0x01);   //write instruction, 16bits
 134   1               Delay_nms(100);                                
 135   1                      
 136   1               write_cmd(0x29);
 137   1               write_data16(0x80,0xb0);
 138   1               Delay_nms(30);         
 139   1               write_cmd(0x29);
 140   1               write_data16(0xff,0xfe);
 141   1               
 142   1                       write_cmd(0x07);
 143   1               write_data16(0x00,0x23);
 144   1                              Delay_nms(30);          

⌨️ 快捷键说明

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