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

📄 xianshi.lst

📁 LCM的控制芯片是ST7541,与单片机相连
💻 LST
📖 第 1 页 / 共 3 页
字号:
C51 COMPILER V7.06   XIANSHI                                                               02/18/2008 17:11:24 PAGE 1   


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

stmt level    source

   1          /***************************************************/
   2          //    program :       714A.c
   3          //    discription   :   IC     ST7541
   4          //                          Dots   128*128
   5          //                          VDD   3.0
   6          //                          Duty   1/128 
   7          //                          Bias    1/11
   8          //                          Vop     11.57V
   9          //     interface :      8 parallel
  10          //     Write by  :     ywq
  11          //     Date       :     2006-7-20
  12          /***************************************************/
  13          
  14          
  15          
  16          #include <reg51.h>
  17          #include <intrins.h>
  18          #define uchar unsigned char
  19          #define uint unsigned int
  20          
  21          uchar code map[];
  22          
  23          sbit cs=P3^0;
  24          sbit reset=P3^1;
  25          sbit A0=P3^2;
  26          sbit wr=P3^3;
  27          sbit rd=P3^4;
  28          uchar code number_2[];
  29          uchar code num2;
  30          uchar code number_3[];
  31          uchar code num3;
  32          
  33          void delay(uint d)   
  34          {
  35   1        uint i,j;
  36   1        for(i=0;i<d;i++)
  37   1              for(j=0;j<1000;j++);
  38   1      }
  39          
  40          
  41          
  42          void write_command(uchar d)
  43          {
  44   1         cs=0;
  45   1         rd=1;  //not read  command 
  46   1         A0=0;  //command
  47   1         wr=0;
  48   1         P1=d;  //write command 
  49   1         wr=1;
  50   1         cs=1;  
  51   1      }
  52          
  53          void write_data(uchar d)
  54          {
  55   1         cs=0;
C51 COMPILER V7.06   XIANSHI                                                               02/18/2008 17:11:24 PAGE 2   

  56   1         rd=1;  
  57   1         A0=1; //data
  58   1         wr=0;
  59   1         P1=d; //write data
  60   1         wr=1;
  61   1         cs=1;
  62   1      }
  63          void clear()
  64          {
  65   1       int i,j;
  66   1       for(i=0;i<16;i++)
  67   1       {
  68   2        write_command(0xb0+i);   //set page adress
  69   2        write_command(0x10);     //Set column address MSB
  70   2        write_command(0x00);     //Set column address LSB
  71   2        for(j=0;j<128;j++)
  72   2        {
  73   3         write_data(0x00);
  74   3         write_data(0x00);
  75   3        }
  76   2       }
  77   1      }
  78          
  79          void initialization()
  80          {
  81   1        reset=0;
  82   1        delay(10); 
  83   1        reset=1;
  84   1        delay(10);
  85   1       
  86   1        /*write_command(0xe2);// reset
  87   1      
  88   1        write_command(0x38);//modeset
  89   1        write_command(0xa0);//modsetp   50
  90   1      
  91   1        write_command(0x48);//duty=1/128
  92   1        write_command(0x80);
  93   1        
  94   1        write_command(0xa1);//ADC 
  95   1        
  96   1        write_command(0xc0);//SHL 
  97   1      
  98   1        write_command(0x40);//initial line register
  99   1        write_command(0x00);
 100   1        write_command(0x44);//initial com0 register
 101   1        write_command(0x00);
 102   1      
 103   1        write_command(0xab);//osc on
 104   1        
 105   1        write_command(0x20);//Rb/Ra ratio ,20~27
 106   1        
 107   1        write_command(0x81);// set reference voltage register
 108   1        write_command(0x20);// a ,ajustable ,00~3F   24
 109   1      
 110   1        write_command(0x57);//bias =1/11
 111   1      
 112   1        write_command(0xa6);//normal display 
 113   1        write_command(0xa4);//entire display off
 114   1          
 115   1        write_command(0x66);//DC-DC  5*  
 116   1       
 117   1        write_command(0x2c);//power control :VC on  
C51 COMPILER V7.06   XIANSHI                                                               02/18/2008 17:11:24 PAGE 3   

 118   1        delay(100);
 119   1        write_command(0x2e);//   VC, VR on
 120   1        delay(5);
 121   1        write_command(0x2f);//   VC, VR, VF on
 122   1       write_command(0x93);//frcpwm set
 123   1                write_command(0x4c);//N-line inversion 1st
 124   1                  write_command(0x00);//frame inversion 2nd
 125   1       
 126   1       write_command(0x88);
 127   1       write_command(0x00);
 128   1       write_command(0x89);
 129   1       write_command(0x00);
 130   1       write_command(0x8a);
 131   1       write_command(0xdd);
 132   1       write_command(0x8b);
 133   1       write_command(0xdd);
 134   1       write_command(0x8c);
 135   1       write_command(0xaa);
 136   1       write_command(0x8d);
 137   1       write_command(0xaa);
 138   1       write_command(0x8e);
 139   1       write_command(0xff);
 140   1       write_command(0x8f);
 141   1       write_command(0xff);
 142   1       
 143   1      // write_command(0xa1);
 144   1      // write_command(0xc0);
 145   1       
 146   1       write_command(0xaf);//display on
 147   1       
 148   1       delay(10);*/
 149   1        write_command(0xe2);// reset
 150   1      
 151   1        write_command(0x38);//modeset
 152   1        write_command(0xd0);//modsetp
 153   1      
 154   1        write_command(0x48);//duty=1/128
 155   1        write_command(0x80);
 156   1        
 157   1        write_command(0xa0);//ADC 
 158   1        
 159   1        write_command(0xc0);//SHL 
 160   1      
 161   1        write_command(0x40);//initial line register
 162   1        write_command(0x00);
 163   1        write_command(0x44);//initial com0 register
 164   1        write_command(0x00);
 165   1      
 166   1        write_command(0xab);//osc on
 167   1        
 168   1        write_command(0x26);//Rb/Ra ratio ,20~27  26
 169   1        
 170   1        write_command(0x81);// set reference voltage register
 171   1        write_command(0x38);// a ,ajustable ,00~3F     25(样品)
 172   1      
 173   1        write_command(0x57);//bias =1/12          
 174   1      
 175   1        write_command(0xa6);//normal display 
 176   1        write_command(0xa4);//entire display off
 177   1          
 178   1        write_command(0x67);//DC-DC  5*     66
 179   1       
C51 COMPILER V7.06   XIANSHI                                                               02/18/2008 17:11:24 PAGE 4   

 180   1        write_command(0x2c);//power control :VC on  
 181   1        delay(100);
 182   1        write_command(0x2e);//   VC, VR on
 183   1        delay(5);
 184   1        write_command(0x2f);//   VC, VR, VF on
 185   1       write_command(0x97);//frcpwm set
 186   1                 write_command(0x4c);//N-line inversion 1st
 187   1                  write_command(0x00);//frame inversion 2nd  00
 188   1       
 189   1       write_command(0x88);
 190   1       write_command(0x00);
 191   1       write_command(0x89);
 192   1       write_command(0x00);
 193   1       write_command(0x8a);
 194   1       write_command(0xdd);
 195   1       write_command(0x8b);
 196   1       write_command(0xdd);
 197   1       write_command(0x8c);
 198   1       write_command(0xaa);
 199   1       write_command(0x8d);
 200   1       write_command(0xaa);
 201   1       write_command(0x8e);
 202   1       write_command(0xff);
 203   1       write_command(0x8f);
 204   1       write_command(0xff);
 205   1       
 206   1      // write_command(0xa1);
 207   1      // write_command(0xc0);
 208   1       
 209   1       write_command(0xaf);//display on
 210   1       
 211   1       delay(10);
 212   1              
 213   1      }
 214          void test_characters()
 215          {
 216   1       int i,j,k,num;
 217   1       uchar code character[]={
 218   1                                      0x55,0xff,0x55,0xff,0x55,0xff,0x55,0xff,
 219   1                                      
 220   1                              //      0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
 221   1                              
 222   1                              //      0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,0XAA,
 223   1                                      0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,
 224   1                                      
 225   1                              };
 226   1       for(num=0;num<2;num++)
 227   1       {
 228   2        for(i=0;i<16;i++)
 229   2        {
 230   3         write_command(0xb0+i);
 231   3         write_command(0x10);
 232   3         write_command(0x00);
 233   3         for(j=0;j<16;j++)
 234   3          for(k=0;k<8;k++)
 235   3          {
 236   4           write_data(character[8*num+k]);
 237   4           write_data(character[8*num+k]);
 238   4          }
 239   3        }
 240   2      //  wait_key();
 241   2        delay(200);
C51 COMPILER V7.06   XIANSHI                                                               02/18/2008 17:11:24 PAGE 5   

 242   2       }
 243   1      }

⌨️ 快捷键说明

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