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

📄 btg-128128d.lst

📁 小彩屏的文档 很爽,具体型号是ssd1332
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V6.21  BTG_128128D                                                            01/06/2006 18:59:56 PAGE 1   


C51 COMPILER V6.21, COMPILATION OF MODULE BTG_128128D
OBJECT MODULE PLACED IN BTG-128128D.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE BTG-128128D.c

stmt level    source

   1          /*------------------------------------------------------------------------------
   2                                  BTG-128128D.C For Testing Module BTG-128128D on AT89S52
   3                                                          The driver is NJU6679
   4                                                                    2005.7.17
   5          ------------------------------------------------------------------------------*/
   6          
   7          #include <reg52.h>                             /* define 8052 registers */
   8          #include <intrins.h>
   9          #include "ascii.h"
  10          //#include "y1.h"
  11          #include "y.h"
  12          
  13          #define uchar unsigned char
  14          #define uint  unsigned int
  15          //-----------------------------------------------------------------------------
  16          //Define Data's Port  
  17          sbit E   =P3^7;
  18          sbit RW  =P3^6;
  19          sbit RS  =P3^2;
  20          sbit CS1 =P3^0;
  21          sbit RST =P3^1;
  22          #define LCD_DATA P1
  23          
  24          //Define Key's Input
  25          #define AUTO 0x80               //P2^7: Input auto_run_id
  26          #define ADDU 0x40               //P2^6: Display picture UP to end
  27          #define SUBD 0x20               //P2^5: Display picture Down to begin
  28          #define ADUP 0x10               //P2^4: For COG module:adjust Register's value to add
  29          #define ADDN 0x08               //P2^3: For COG moduel:adjust Register's value to sub
  30          #define KEY_IN  P2
  31          
  32          //For LCD to work 
  33          //#define bias 
  34          //#define duty
  35          //#define Rab           0x27    //Select 6times
  36          #define v0              0x34    //Set V0=14.3V
  37          #define bias    0xb8    //Set bias=1/12
  38          uchar constr;                   //对比度调节
  39          
  40          //Control the program to run
  41          #define BmpMax 7
  42          uchar autoid;                   //Indicate that LCD display automatically
  43          uchar bmp_id;                   //The picture's id to display
  44          uchar dispid;                   //To reflash the display picture
  45          
  46          #define dl0 1000
  47          //*****************************************************************************
  48          //uchar code q[8]={0x3E,0x41,0x41,0x51,0x21,0x5E,0x00,0x00};
  49          
  50          //*****************************************************************************
  51          //-----------------------------------------------------------------------------
  52          void delay_us(uchar us_value)   //delay about 1 us
  53          {
  54   1              while(us_value--)
  55   1              {
C51 COMPILER V6.21  BTG_128128D                                                            01/06/2006 18:59:56 PAGE 2   

  56   2                      _nop_();
  57   2                      _nop_();
  58   2                      _nop_();
  59   2              }
  60   1      }
  61          //-----------------------------------------------------------------------------
  62          void delay_ms(uint ms_value)    //delay about 1 ms
  63          {
  64   1              uint k;
  65   1      
  66   1              for(k=0;k<ms_value;k++)
  67   1              {
  68   2                      delay_us(200);
  69   2              }
  70   1      }
  71          //-----------------------------------------------------------------------------
  72          void init_cpu() //Initial 89C52                                                         
  73          {
  74   1              LCD_DATA=0;
  75   1      
  76   1              RS =0;
  77   1              RW =0;
  78   1              E  =0;
  79   1              RST=0;
  80   1              CS1=0;
  81   1              delay_ms(1);
  82   1              RST=1;
  83   1              delay_us(10);
  84   1      }
  85          //-----------------------------------------------------------------------------
  86          uchar read_stat(void)
  87          {
  88   1              uchar tmp_stat;
  89   1      
  90   1              RS =0;
  91   1              RW =1;
  92   1              E  =1;
  93   1              delay_us(2);
  94   1              tmp_stat=LCD_DATA;
  95   1              E  =0;
  96   1              delay_us(1);
  97   1      
  98   1              return tmp_stat;
  99   1      }
 100          //-----------------------------------------------------------------------------
 101          void wait()
 102          {
 103   1      delay_us(1);
 104   1      //      while((read_stat()&0x80)==0x80);
 105   1      }
 106          //-----------------------------------------------------------------------------
 107          void wr_cmd(uchar wrcmd)
 108          {
 109   1              wait();
 110   1              RS =0;  //select instruction
 111   1              RW =0;  //to write
 112   1              E=1;
 113   1              CS1=0;
 114   1              LCD_DATA=wrcmd;
 115   1              delay_us(2);
 116   1              CS1=1;
 117   1          delay_us(2);
C51 COMPILER V6.21  BTG_128128D                                                            01/06/2006 18:59:56 PAGE 3   

 118   1          E=1;
 119   1              RW=1;
 120   1              }
 121          //-----------------------------------------------------------------------------
 122          void wr_data(uchar wrdata)
 123          {
 124   1              wait();
 125   1              RS =1;  //select data
 126   1              RW =0;  //to write
 127   1              E=1;
 128   1              CS1=0;
 129   1              LCD_DATA=wrdata;
 130   1      
 131   1              delay_us(2);
 132   1              CS1=1;
 133   1              delay_us(2);
 134   1              E=1;
 135   1              RW=1;
 136   1      }
 137          
 138          //-----------------------------------------------------------------------------
 139          void init_lcd()
 140          {   int i;
 141   1          wr_cmd(0x15);       //SET BIAS
 142   1              wr_cmd(0x00);   //Set line0 to COM0
 143   1      //      wr_cmd(0x26);
 144   1      //      wr_cmd(0x01);
 145   1      //      wr_cmd(0x00);
 146   1      //      wr_cmd(0x00);
 147   1      //      wr_cmd(0x07);
 148   1              wr_cmd(0x5f);
 149   1              wr_cmd(0x75);
 150   1              wr_cmd(0x00);
 151   1              wr_cmd(0x3f);
 152   1              wr_cmd(0x81);
 153   1              wr_cmd(0x80);
 154   1              wr_cmd(0x82);
 155   1              wr_cmd(0x80);
 156   1              wr_cmd(0x83);
 157   1              wr_cmd(0x80);
 158   1              wr_cmd(0x87);
 159   1              wr_cmd(0x0f);
 160   1              wr_cmd(0xa0);
 161   1              wr_cmd(0x72);
 162   1              wr_cmd(0xa1);
 163   1              wr_cmd(0x00);
 164   1              wr_cmd(0xa2);
 165   1              wr_cmd(0x00);
 166   1              wr_cmd(0xa4);
 167   1              wr_cmd(0xa8);
 168   1              wr_cmd(0x3f);
 169   1              wr_cmd(0xaf);  
 170   1          wr_cmd(0xb8);
 171   1          for(i=0;i<32;i++)
 172   1              { 
 173   2          wr_cmd(2*i);
 174   2              }
 175   1      
 176   1              delay_ms(1);
 177   1      }
 178          //-----------------------------------------------------------------------------
 179          void disp_all()
C51 COMPILER V6.21  BTG_128128D                                                            01/06/2006 18:59:56 PAGE 4   

 180          {
 181   1              uchar ii,jj;
 182   1      wr_cmd(0x15);
 183   1      wr_cmd(0x00);
 184   1      wr_cmd(0x5f);
 185   1      wr_cmd(0x75);
 186   1      wr_cmd(0x00);
 187   1      wr_cmd(0x3f);
 188   1              for(ii=0;ii<64;ii++)
 189   1              {
 190   2      
 191   2                      for(jj=0;jj<96;jj++)
 192   2                      {
 193   3                              wr_data(0xff);
 194   3                              wr_data(0xff);
 195   3      
 196   3                      }
 197   2              }
 198   1      
 199   1      }
 200          
 201          void disp_all1()
 202          {
 203   1              uchar ii,jj;
 204   1      wr_cmd(0x15);
 205   1      wr_cmd(0x00);
 206   1      wr_cmd(0x5f);
 207   1      wr_cmd(0x75);
 208   1      wr_cmd(0x00);
 209   1      wr_cmd(0x3f);
 210   1              for(ii=0;ii<64;ii++)
 211   1              {
 212   2                      for(jj=0;jj<96;jj++)
 213   2                      {
 214   3      
 215   3                              wr_data(0x03);
 216   3                              wr_data(0xe0);
 217   3      
 218   3                      }
 219   2              }
 220   1      
 221   1      }
 222          void disp_all2()
 223          {
 224   1              uchar ii,jj;
 225   1      wr_cmd(0x15);
 226   1      wr_cmd(0x00);
 227   1      wr_cmd(0x5f);
 228   1      wr_cmd(0x75);
 229   1      wr_cmd(0x00);
 230   1      wr_cmd(0x3f);
 231   1              for(ii=0;ii<64;ii++)
 232   1              {
 233   2      
 234   2                      for(jj=0;jj<96;jj++)
 235   2                      {
 236   3                              wr_data(0x00);
 237   3                              wr_data(0x1f);
 238   3                      }

⌨️ 快捷键说明

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