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

📄 uc1697vmtp.lst

📁 ultrachip uc1698 test programe with MTP
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V8.02   UC1697VMTP                                                            05/20/2008 12:39:31 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE UC1697VMTP
OBJECT MODULE PLACED IN UC1697vmtp.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE UC1697vmtp.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          //UC1698u---128*160 2007-12-12
   2          #include "reg51.h"
   3          #include "uc1697.h"
   4          
   5          sbit CS0 = P3^0;
   6          sbit RST = P3^5;
   7          sbit CD  = P3^6;        
   8          sbit WR0 = P3^7;        
   9          sbit WR1 = P3^4;
  10          
  11          sbit K2=P0^1;
  12          sbit K3=P3^3;
  13          sbit K1=P3^2;
  14          sbit K4=P0^0;
  15           
  16             unsigned char pm=0x70;/*vop,PM值*/
  17             unsigned char pmm=0x00;/*vop加减后的临界值*/
  18             unsigned char dv0=0x00;/*VOP增减基数*/
  19             unsigned char dv=0x40;/*MTP阶数*/
  20             unsigned char pm0=0x00;/*vop偏移量的值*/
  21             unsigned char pm01=0x00;/*一位一位写入寄存器*/
  22          
  23          void init(void);
  24          void display_black(void);
  25          void display_white(void);
  26          void writei(unsigned char d);
  27          void writed(unsigned char d);
  28          void horizontal();
  29          void vertical();
  30          void frame();
  31          void snow();
  32          void delay(long tt);
  33          void display_rgb(unsigned char a,unsigned char b);
  34          void display_colorbar();
  35          void display_pic();
  36          void windowprogram(void);
  37          void vopup(void);
  38          void vopdown(void);
  39          void otp_erase(void);
  40          void otp_operation(void);
  41          void otp_program(void);
  42          void count(void);
  43          unsigned char kscan();
  44          void redgray();
  45          unsigned char readcmd(void);
  46          
  47          void main(void)
  48          {
  49   1      unsigned char key=0;
  50   1      
  51   1      RST=0;
  52   1      delay(200);
  53   1      RST=1;
  54   1      delay(20000);
  55   1      init();
C51 COMPILER V8.02   UC1697VMTP                                                            05/20/2008 12:39:31 PAGE 2   

  56   1      display_pic();
  57   1      
  58   1      delay(20000);
  59   1      
  60   1      
  61   1      readcmd();
  62   1      
  63   1      delay(20000);
  64   1      
  65   1      while(1)
  66   1         {
  67   2              key= key+kscan();
  68   2              if(key>6) key=1;
  69   2              switch(key)
  70   2              {
  71   3                      case 1:{display_rgb(0xf8,0x00);}break;//r
  72   3                      case 2:{display_rgb(0x07,0xe0);}break;//g
  73   3                      case 3:{display_rgb(0x00,0x1f);}break;//b
  74   3                      case 4:{display_colorbar() ;} break;
  75   3                      case 5:{display_pic();      } break;
  76   3                      case 6:{redgray();          } break;
  77   3                      default:break;
  78   3      
  79   3              }
  80   2          }
  81   1          
  82   1      }
  83          
  84          void redgray()
  85          {
  86   1              int i,j;
  87   1          unsigned char red;
  88   1          for(red=0x08;red<=0xf8;red=red+0x10)
  89   1              {
  90   2              for(i=0;i<16;i++)
  91   2                {
  92   3              for(j=0;j<80;j++)
  93   3                  {
  94   4                      writed(red);writed(0x00);
  95   4                  }
  96   3                }     
  97   2                if(red==0xf8)
  98   2                break;
  99   2      }
 100   1      }
 101          
 102          
 103          unsigned char kscan()
 104          {
 105   1              //unsigned char i=80;
 106   1              while(1)
 107   1              {
 108   2                      if(K1==0|K2==0|K3==0|K4==0)
 109   2                      {
 110   3                              if(K1==0)
 111   3                              {
 112   4                                      delay(10);
 113   4                                      if(K1==1)
 114   4                                      {
 115   5                                              delay(10);
 116   5                          
 117   5                                              return(1);
C51 COMPILER V8.02   UC1697VMTP                                                            05/20/2008 12:39:31 PAGE 3   

 118   5                                      }
 119   4                              }
 120   3                              if(K2==0)
 121   3                              {
 122   4                                      delay(10);
 123   4      
 124   4                                      if(K2==1)
 125   4                                      {
 126   5                            delay(100);
 127   5                            otp_erase();   /*一定要erase before programme*/
 128   5                            delay(100);
 129   5                                        vopup();
 130   5                                        delay(100);   
 131   5                                      }
 132   4                              }
 133   3                              if(K3==0)
 134   3                              {
 135   4                                      delay(10);
 136   4                                      if(K3==1)
 137   4                                      {
 138   5                                      delay(100);
 139   5                                      otp_erase();   /*一定要erase before programme*/
 140   5                                      delay(100);
 141   5                                      vopdown();
 142   5                                  delay(100);
 143   5                                      }
 144   4                              }
 145   3                              if(K4==0)
 146   3                         {
 147   4                               delay(10);     
 148   4                               if(K4==1)
 149   4                              {
 150   5                                      delay(100);
 151   5                                      otp_operation();
 152   5                              
 153   5                              }
 154   4                         }
 155   3                         
 156   3                      }
 157   2              }
 158   1      }
 159          
 160          void init(void)
 161          {
 162   1      
 163   1        //  writei(0xb8);
 164   1      //   writei(0x00);
 165   1      
 166   1      //&&&&&&&&& Display Setting &&&&&&&&&********
 167   1      
 168   1      
 169   1          writei(0xe2);   //system reset
 170   1          delay(100);
 171   1      
 172   1      
 173   1          writei(0x2f);   //set power control
 174   1      
 175   1              writei(0x24);
 176   1      
 177   1          writei(0x2b);
 178   1      
 179   1              //writei(0xeb);  //SET lcd bias 1/12  writei(0xea);
C51 COMPILER V8.02   UC1697VMTP                                                            05/20/2008 12:39:31 PAGE 4   

 180   1      
 181   1              //writei(0x81);   //set Vbias potentiometer
 182   1              //writei(0x66);   //0~255   writei(0x70);
 183   1      
 184   1              writei(0xea);
 185   1      
 186   1              writei(0x81);   //set Vbias potentiometer
 187   1              writei(0x70);
 188   1      //      writei(0x76);   //0~255   writei(0x76);
 189   1      //      writei(0xc2);
 190   1      //  writei(0x8b);   //set ram address contrast  89
 191   1      
 192   1          writei(0xa3);
 193   1      
 194   1              writei(0xc8);   //set N-LINE inversion
 195   1          writei(0x18);
 196   1      
 197   1          writei(0xc0);
 198   1      
 199   1              writei(0xd1);   //SET color pattern
 200   1          writei(0xd6);  //SET color mode --65k color
 201   1      
 202   1      
 203   1              writei(0xde);
 204   1          writei(0xaf);   //set display enable
 205   1      
 206   1      }
 207          
 208          
 209          void windowprogram(void)
 210          {
 211   1      
 212   1            writei(0x70);
 213   1            writei(0x60);
 214   1                writei(0x10);
 215   1                writei(0x00);
 216   1      
 217   1            writei(0xF4);//set colum address start
 218   1            writei(0x00);
 219   1      
 220   1            writei(0xF6);
 221   1            writei(0x7f);//set colum address end
 222   1      
 223   1            writei(0xF5);//set row address start
 224   1            writei(0x00);
 225   1      
 226   1            writei(0xF7);//set row address end
 227   1            writei(0x9f);
 228   1            writei(0xF8);//set window outside mode enable
 229   1      
 230   1      }
 231          
 232          
 233          unsigned char readcmd(void)
 234          {  
 235   1      unsigned char status1,status2,status3;
 236   1      
 237   1      CS0=0;
 238   1      WR0=1;
 239   1      P1=0xff; 
 240   1      CD=0;
 241   1      
C51 COMPILER V8.02   UC1697VMTP                                                            05/20/2008 12:39:31 PAGE 5   

 242   1      WR1=0;
 243   1      status1=P1;
 244   1      WR1=1;
 245   1      P1=status1;
 246   1      
 247   1      CS0=0;
 248   1      WR0=1;
 249   1      P1=0xff; 
 250   1      CD=0;
 251   1      
 252   1      WR1=0;
 253   1      status2=P1;
 254   1      WR1=1;
 255   1      P1=status2;
 256   1      
 257   1      CS0=0;
 258   1      WR0=1;
 259   1      P1=0xff;
 260   1      CD=0;
 261   1      
 262   1      WR1=0;
 263   1      status3=P1;
 264   1      WR1=1;
 265   1      P1=status3;
 266   1      
 267   1      CS0=1;
 268   1      return(status2);
 269   1      }
 270          
 271          void display_pic()
 272          {
 273   1         int i,j,k=0; 
 274   1         windowprogram();
 275   1         for(i=0;i<128;i++)
 276   1              {
 277   2               for(j=0;j<320;j++)
 278   2                 {writed(pic[k++]);}
 279   2                      
 280   2              }
 281   1      }
 282          
 283          
 284          void display_colorbar()
 285          {
 286   1              int i,j;
 287   1      
 288   1              for(i=0;i<16;i++)//r
 289   1              {
 290   2              for(j=0;j<160;j++)
 291   2              {writed(0xf8);writed(0x00);}
 292   2              }
 293   1      
 294   1              for(i=0;i<16;i++)//rg
 295   1              {
 296   2              for(j=0;j<160;j++)
 297   2              {writed(0xff);writed(0xe0);}
 298   2              }
 299   1      
 300   1              for(i=0;i<16;i++)//g
 301   1              {
 302   2              for(j=0;j<160;j++)
 303   2              {writed(0x07);writed(0xe0);}
C51 COMPILER V8.02   UC1697VMTP                                                            05/20/2008 12:39:31 PAGE 6   

 304   2              }
 305   1      
 306   1              for(i=0;i<16;i++)//gb
 307   1              {
 308   2              for(j=0;j<160;j++)
 309   2              {writed(0x07);writed(0xff);}
 310   2              }
 311   1      

⌨️ 快捷键说明

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