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

📄 9325.lst

📁 LCD双屏 主屏:ILI9325 副屏:SSD1303
💻 LST
📖 第 1 页 / 共 2 页
字号:
 209          
 210          
 211          
 212          void key_function1()
 213          {
 214   1        unsigned char key_flag1=0;
 215   1      //  if(!key1) key_flag1=1;
 216   1      
 217   1              do
 218   1              {
 219   2                if(!key1)  key_flag1=1;
 220   2                Delay(10);
 221   2              }
 222   1          while(key_flag1==0);
 223   1              Delay(30);
 224   1              key_flag1=0;
 225   1      } 
 226          
 227          
 228          void main_R61505U_initial()
 229          {
 230   1      
 231   1        mainlcd_send_command(0x00,0xE3);mainlcd_send_data( 0x30,0x08); // Set internal timing
 232   1        mainlcd_send_command(0x00,0xE7);mainlcd_send_data( 0x00,0x12); // Set internal timing
 233   1        mainlcd_send_command(0x00,0xEF);mainlcd_send_data( 0x12,0x31); // Set internal timing
 234   1        mainlcd_send_command(0x00,0x01);mainlcd_send_data( 0x01,0x00); // set SS and SM bit
 235   1        mainlcd_send_command(0x00,0x02);mainlcd_send_data( 0x07,0x00); // set 1 line inversion
 236   1        mainlcd_send_command(0x00,0x03);mainlcd_send_data( 0x10,0x30); // set GRAM write direction and BGR=1.
 237   1        mainlcd_send_command(0x00,0x04);mainlcd_send_data( 0x00,0x00); // Resize register
 238   1        mainlcd_send_command(0x00,0x08);mainlcd_send_data( 0x02,0x07); // set the back porch and front porch
C51 COMPILER V7.02a   9325                                                                 11/06/2008 09:33:46 PAGE 5   

 239   1        mainlcd_send_command(0x00,0x09);mainlcd_send_data( 0x00,0x00); // set non-display area refresh cycle ISC
             -[3:0]
 240   1        mainlcd_send_command(0x00,0x0A);mainlcd_send_data( 0x00,0x00); // FMARK function
 241   1        mainlcd_send_command(0x00,0x0C);mainlcd_send_data( 0x00,0x00); // RGB interface setting
 242   1        mainlcd_send_command(0x00,0x0D);mainlcd_send_data( 0x00,0x00); // Frame marker Position
 243   1        mainlcd_send_command(0x00,0x0F);mainlcd_send_data( 0x00,0x00); // RGB interface polarity
 244   1        //*************Power On sequence ****************//
 245   1        mainlcd_send_command(0x00,0x10);mainlcd_send_data( 0x00,0x00); // SAP, BT[3:0], AP, DSTB, SLP, STB
 246   1        mainlcd_send_command(0x00,0x11);mainlcd_send_data( 0x00,0x07); // DC1[2:0], DC0[2:0], VC[2:0]
 247   1        mainlcd_send_command(0x00,0x12);mainlcd_send_data( 0x00,0x00); // VREG1OUT voltage
 248   1        mainlcd_send_command(0x00,0x13);mainlcd_send_data( 0x00,0x00); // VDV[4:0] for VCOM amplitude
 249   1          Delay(200);                        // Dis-charge capacitor power voltage
 250   1        mainlcd_send_command(0x00,0x10);mainlcd_send_data( 0x12,0x90); // SAP, BT[3:0], AP, DSTB, SLP, STB
 251   1        mainlcd_send_command(0x00,0x11);mainlcd_send_data( 0x00,0x01); // R11h=0x0221 at VCI=3.3V, DC1[2:0], DC0
             -[2:0], VC[2:0]
 252   1          Delay(50);                         // Delay 50ms
 253   1        mainlcd_send_command(0x00,0x12);mainlcd_send_data( 0x00,0x94); // External reference voltage= Vci;
 254   1          Delay(50);                         // Delay 50ms
 255   1        mainlcd_send_command(0x00,0x13);mainlcd_send_data( 0x1a,0x00); // VDV[4:0] for VCOM amplitude
 256   1        mainlcd_send_command(0x00,0x29);mainlcd_send_data( 0x00,0x25); // VCM[5:0] for VCOMH
 257   1        mainlcd_send_command(0x00,0x2B);mainlcd_send_data( 0x00,0x0d); // Frame Rate = 51Hz
 258   1          Delay(50);                         // Delay 50ms
 259   1        mainlcd_send_command(0x00,0x20);mainlcd_send_data( 0x00,0x00); // GRAM horizontal Address
 260   1        mainlcd_send_command(0x00,0x21);mainlcd_send_data( 0x00,0x00); // GRAM Vertical Address
 261   1        // ----------- Adjust the Gamma Curve ----------//
 262   1        mainlcd_send_command(0x00,0x30);mainlcd_send_data( 0x00,0x00);
 263   1        mainlcd_send_command(0x00,0x31);mainlcd_send_data( 0x05,0x06);
 264   1        mainlcd_send_command(0x00,0x32);mainlcd_send_data( 0x01,0x04);
 265   1        mainlcd_send_command(0x00,0x35);mainlcd_send_data( 0x02,0x07);
 266   1        mainlcd_send_command(0x00,0x36);mainlcd_send_data( 0x00,0x0f);
 267   1        mainlcd_send_command(0x00,0x37);mainlcd_send_data( 0x03,0x06);
 268   1        mainlcd_send_command(0x00,0x38);mainlcd_send_data( 0x01,0x02);
 269   1        mainlcd_send_command(0x00,0x39);mainlcd_send_data( 0x07,0x07);
 270   1        mainlcd_send_command(0x00,0x3C);mainlcd_send_data( 0x07,0x02);
 271   1        mainlcd_send_command(0x00,0x3D);mainlcd_send_data( 0x16,0x04);
 272   1        //------------------ Set GRAM area ---------------//
 273   1        mainlcd_send_command(0x00,0x50);mainlcd_send_data( 0x00,0x00); // Horizontal GRAM Start Address
 274   1        mainlcd_send_command(0x00,0x51);mainlcd_send_data( 0x00,0xEF); // Horizontal GRAM End Address
 275   1        mainlcd_send_command(0x00,0x52);mainlcd_send_data( 0x00,0x00); // Vertical GRAM Start Address
 276   1        mainlcd_send_command(0x00,0x53);mainlcd_send_data( 0x01,0x3F); // Vertical GRAM Start Address
 277   1        mainlcd_send_command(0x00,0x60);mainlcd_send_data( 0x27,0x00); // Gate Scan Line
 278   1        mainlcd_send_command(0x00,0x61);mainlcd_send_data( 0x00,0x01); // NDL,VLE, REV
 279   1        mainlcd_send_command(0x00,0x6A);mainlcd_send_data( 0x00,0x00); // set scrolling line
 280   1        //-------------- Partial Display Control ---------//
 281   1        mainlcd_send_command(0x00,0x80);mainlcd_send_data( 0x00,0x00);
 282   1        mainlcd_send_command(0x00,0x81);mainlcd_send_data( 0x00,0x00);
 283   1        mainlcd_send_command(0x00,0x82);mainlcd_send_data( 0x00,0x00);
 284   1        mainlcd_send_command(0x00,0x83);mainlcd_send_data( 0x00,0x00);
 285   1        mainlcd_send_command(0x00,0x84);mainlcd_send_data( 0x00,0x00);
 286   1        mainlcd_send_command(0x00,0x85);mainlcd_send_data( 0x00,0x00);
 287   1        //-------------- Panel Control -------------------//
 288   1        mainlcd_send_command(0x00,0x90);mainlcd_send_data( 0x00,0x10);
 289   1        mainlcd_send_command(0x00,0x92);mainlcd_send_data( 0x06,0x00);
 290   1        mainlcd_send_command(0x00,0x93);mainlcd_send_data( 0x00,0x03);
 291   1        mainlcd_send_command(0x00,0x95);mainlcd_send_data( 0x01,0x10);
 292   1        mainlcd_send_command(0x00,0x97);mainlcd_send_data( 0x00,0x00);
 293   1        mainlcd_send_command(0x00,0x98);mainlcd_send_data( 0x00,0x00);
 294   1        mainlcd_send_command(0x00,0x07);mainlcd_send_data( 0x01,0x33); // 262K color and display ON
 295   1      
 296   1              mainlcd_send_command(0x00,0x22);        
 297   1      
 298   1      
C51 COMPILER V7.02a   9325                                                                 11/06/2008 09:33:46 PAGE 6   

 299   1      }
 300          
 301          void DisplayMainFrame()
 302          {
 303   1         int i,j;
 304   1      //   Csm=0x00;
 305   1      //   R61505U_address(0x00,0xef,0x00,0x00,0x01,0x3f,0x00,0x00,0x3f);
 306   1         mainlcd_send_command(0x00,0x22);
 307   1         for(i=0;i<240;i++)
 308   1          {
 309   2               mainlcd_send_data(0xFF,0xFF);
 310   2          }
 311   1         for(i=0;i<318;i++)
 312   1          {
 313   2               mainlcd_send_data(0xFF,0xFF);
 314   2               for(j=0;j<238;j++)
 315   2                 {
 316   3                       mainlcd_send_data(0x00,0x00);
 317   3                 }
 318   2               mainlcd_send_data(0xFF,0xFF);
 319   2          }
 320   1         for(i=0;i<240;i++)
 321   1          {
 322   2               mainlcd_send_data(0xFF,0xFF);
 323   2          }
 324   1      }
 325          
 326          
 327          
 328          main()
 329          {
 330   1      
 331   1              DataH=0xff;
 332   1              DataL=0xff;
 333   1      //      Contr=0xff;
 334   1              memic_id=0xff;
 335   1              sc=0x01;
 336   1              Csm=0x00;
 337   1      
 338   1       Reset=0x00;
 339   1       Delay(25);
 340   1       Reset=0x01;
 341   1       Delay(25);
 342   1      
 343   1       main_R61505U_initial();
 344   1       
 345   1      // read_id();
 346   1       //key_function1();
 347   1      
 348   1       while(1)
 349   1       {
 350   2       unsigned int j, i; 
 351   2       //men_photo1(); 
 352   2      //key_function1();
 353   2       //men_photo2(); 
 354   2      //key_function1();
 355   2      // men_photo3(); 
 356   2      //key_function1();
 357   2       ScrMainFullColor(0xF8,0x00);//红
 358   2       key_function1();
 359   2      
 360   2       ScrMainFullColor(0x07,0xE0);//绿
C51 COMPILER V7.02a   9325                                                                 11/06/2008 09:33:46 PAGE 7   

 361   2       key_function1();
 362   2      
 363   2       ScrMainFullColor(0x00,0x1F);//蓝
 364   2       key_function1();
 365   2      
 366   2      ScrMainFullColor(0x00,0x00);//黑
 367   2      key_function1();
 368   2      
 369   2       ScrMainFullColor(0xFF,0xFF);//白
 370   2       key_function1();
 371   2      
 372   2        DisplayMainFrame();//框
 373   2       key_function1();
 374   2      
 375   2      //men_photo1(); 
 376   2      //key_function1();
 377   2      
 378   2      Csm=1;
 379   2      Delay(10);
 380   2      Css=0;
 381   2      Delay(10);
 382   2      sub_1303_initial();
 383   2      Delay(50);
 384   2      for(i=0;i<8;i++) 
 385   2      {
 386   3       sublcd_send_command(0x00,0xB0+i);//设置显示位置—行
 387   3       sublcd_send_command(0x00,0x00); //设置显示位置—列低地址 
 388   3       sublcd_send_command(0x00,0x10); //设置显示位置—列高地址
 389   3      
 390   3      for(j=0;j<128;j++) 
 391   3       sublcd_send_init_data(0x00,0xFF);//屏幕显示,全亮 
 392   3      } 
 393   2      key_function1();
 394   2      for(i=0;i<8;i++) 
 395   2      {
 396   3       sublcd_send_command(0x00,0xB0+i);//设置显示位置—行 
 397   3       sublcd_send_command(0x00,0x00); //设置显示位置—列低地址 
 398   3       sublcd_send_command(0x00,0x10); //设置显示位置—列高地?
 399   3      
 400   3      for(j=0;j<128;j++) 
 401   3       sublcd_send_init_data(0x00,0x00);//屏幕显示,全灭 
 402   3       }
 403   2      key_function1();                                         
 404   2       }
 405   1      
 406   1      }
 407          
 408          
 409          
 410          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1248    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      2      15
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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