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

📄 s6d0144.lst

📁 test ili9320 for keil c
💻 LST
📖 第 1 页 / 共 2 页
字号:
 363   1      
 364   1      for(ii=0;ii<240;ii++)
 365   1      W_D(0xff,0xff);
C51 COMPILER V7.50   S6D0144                                                               05/29/2007 09:06:46 PAGE 7   

 366   1      
 367   1      
 368   1      for(i=0;i<318;i++)
 369   1      {
 370   2      W_D(0xf8,0x0);
 371   2      for(ii=0;ii<238;ii++)
 372   2      W_D(0x0,0);
 373   2      
 374   2      W_D(0x0,0x1f);
 375   2      }
 376   1      
 377   1      for(ii=0;ii<240;ii++)
 378   1      W_D(0xff,0xff);
 379   1      
 380   1      }
 381          
 382          void display6()//clear
 383          {
 384   1      unsigned char i,ii;
 385   1      set_whole_screen();
 386   1      
 387   1              for(ii=0;ii<32;ii++)
 388   1              for(i=0;i<240;i++)
 389   1                      W_D2(RGB(254,0,0));//red
 390   1                      
 391   1              for(ii=0;ii<32;ii++)
 392   1              for(i=0;i<240;i++)
 393   1                      W_D2(RGB(0,254,0));//g
 394   1      
 395   1              for(ii=0;ii<32;ii++)
 396   1              for(i=0;i<240;i++)
 397   1                      W_D2(RGB(0,0,254));//b
 398   1      
 399   1              for(ii=0;ii<32;ii++)
 400   1              for(i=0;i<240;i++)
 401   1                      W_D2(RGB(0,254,254));//b+g
 402   1      
 403   1              for(ii=0;ii<32;ii++)
 404   1              for(i=0;i<240;i++)
 405   1                      W_D2(RGB(254,0,254));//r+b
 406   1      
 407   1      
 408   1              for(ii=0;ii<32;ii++)
 409   1              for(i=0;i<240;i++)
 410   1                      W_D2(RGB(254,254,0));//r+g
 411   1      
 412   1              
 413   1              for(ii=0;ii<32;ii++)
 414   1              for(i=0;i<240;i++)
 415   1                      W_D2(RGB(0,0,0));//black
 416   1      
 417   1              for(ii=0;ii<32;ii++)
 418   1              for(i=0;i<240;i++)
 419   1                      W_D2(RGB(254,254,254));//white
 420   1       
 421   1              
 422   1              for(ii=0;ii<32;ii++)
 423   1              for(i=0;i<240;i++)
 424   1                      W_D2(RGB(0,0,0));//black
 425   1      
 426   1              for(ii=0;ii<32;ii++)
 427   1              for(i=0;i<240;i++)
C51 COMPILER V7.50   S6D0144                                                               05/29/2007 09:06:46 PAGE 8   

 428   1                      W_D2(RGB(254,254,254));//white
 429   1      
 430   1      
 431   1      
 432   1      }//end sub
 433          
 434           
 435          
 436          
 437           
 438          
 439          //////////////////////
 440          void delay(uint ms)
 441          {uint a,b;
 442   1       
 443   1      for(b=0;b<ms;b++)
 444   1        for(a=0;a<900;a++)
 445   1          {nop;nop;}
 446   1      }
 447          
 448          void delays()
 449          {
 450   1      _nop_(); _nop_();_nop_();//_nop_();_nop_();_nop_();_nop_();_nop_();
 451   1      }
 452           
 453          
 454          void delay_check_key()
 455          {
 456   1      unsigned char a;
 457   1      
 458   1      for(a=0;a<10;a++)
 459   1      {
 460   2      delay(50); 
 461   2      //check_key();
 462   2              
 463   2      }
 464   1      //LED=~LED;
 465   1              if(auto_loop==1)
 466   1              {
 467   2              
 468   2                      if(current_display<MAX_STEP)
 469   2                              {current_display++;}
 470   2                      else
 471   2                              {current_display=1;}//for auto change 
 472   2              }
 473   1      }
 474            
 475          void HX8312_init2()
 476          {
 477   1      RES=0;
 478   1      delay(300);
 479   1      RES=1;
 480   1      delay(100);
 481   1      //************* Start Initial Sequence **********//
 482   1      CMD16(0x002b, 0x0000);
 483   1      CMD16(0x00E5, 0x8000); // Set the Vcore voltage and this setting is must.
 484   1      CMD16(0x0000, 0x0001); // Start internal OSC.
 485   1      CMD16(0x0001, 0x0100); // set SS and SM bit
 486   1      CMD16(0x0002, 0x0700); // set 1 line inversion
 487   1      CMD16(0x0003, 0x1030); // set GRAM write direction and BGR=1.
 488   1      CMD16(0x0004, 0x0000); // Resize register
 489   1      CMD16(0x0008, 0x0202); // set the back porch and front porch
C51 COMPILER V7.50   S6D0144                                                               05/29/2007 09:06:46 PAGE 9   

 490   1      CMD16(0x0009, 0x0000); // set non-display area refresh cycle ISC[3:0]
 491   1      CMD16(0x000A, 0x0000); // FMARK function
 492   1      CMD16(0x000C, 0x0000); // RGB interface setting
 493   1      CMD16(0x000D, 0x0000); // Frame marker Position
 494   1      CMD16(0x000F, 0x0000); // RGB interface polarity
 495   1      //*************Power On sequence ****************//
 496   1      CMD16(0x0010, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB
 497   1      CMD16(0x0011, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0]
 498   1      CMD16(0x0012, 0x0000); // VREG1OUT voltage
 499   1      CMD16(0x0013, 0x0000); // VDV[4:0] for VCOM amplitude
 500   1      delay(200); // Dis-charge capacitor power voltage
 501   1      CMD16(0x0010, 0x17B0); // SAP, BT[3:0], AP, DSTB, SLP, STB
 502   1      CMD16(0x0011, 0x0007); // R11h=0x0001 at VCI=3.3V DC1[2:0], DC0[2:0], VC[2:0]
 503   1      delay(50); // Delay 50ms
 504   1      CMD16(0x0012, 0x013A); // R11h=0x0138 at VCI=3.3V VREG1OUT voltage
 505   1      delay(50); // Delay 50ms
 506   1      CMD16(0x0013, 0x1A00); // R11h=0x1800 at VCI=3.3V VDV[4:0] for VCOM amplitude
 507   1      CMD16(0x0029, 0x000C); // R11h=0x0008 at VCI=3.3V VCM[4:0] for VCOMH
 508   1      delay(50);
 509   1      CMD16(0x0020, 0x0000); // GRAM horizontal Address
 510   1      CMD16(0x0021, 0x0000); // GRAM Vertical Address
 511   1      // ----------- Adjust the Gamma Curve ----------//
 512   1      CMD16(0x0030, 0x0000);
 513   1      CMD16(0x0031, 0x0505);
 514   1      CMD16(0x0032, 0x0004);
 515   1      CMD16(0x0035, 0x0006);
 516   1      CMD16(0x0036, 0x0707);
 517   1      CMD16(0x0037, 0x0105);
 518   1      CMD16(0x0038, 0x0002);
 519   1      CMD16(0x0039, 0x0707);
 520   1      CMD16(0x003C, 0x0704);
 521   1      CMD16(0x003D, 0x0807);
 522   1      //------------------ Set GRAM area ---------------//             
 523   1      CMD16(0x0050, 0x0000);  // Horizontal GRAM Start Address         
 524   1      CMD16(0x0051, 0x00EF);  // Horizontal GRAM End Address   
 525   1      CMD16(0x0052, 0x0000);  // Vertical GRAM Start Address   
 526   1      CMD16(0x0053, 0x013F);  // Vertical GRAM Start Address   
 527   1      CMD16(0x0060, 0x2700);  // Gate Scan Line        
 528   1      CMD16(0x0061, 0x0001);  // NDL,VLE, REV          
 529   1      CMD16(0x006A, 0x0000);  // set scrolling line    
 530   1      //-------------- Partial Display Control ---------//             
 531   1      CMD16(0x0080, 0x0000);           
 532   1      CMD16(0x0081, 0x0000);           
 533   1      CMD16(0x0082, 0x0000);           
 534   1      CMD16(0x0083, 0x0000);           
 535   1      CMD16(0x0084, 0x0000);           
 536   1      CMD16(0x0085, 0x0000);           
 537   1      //-------------- Panel Control -------------------//             
 538   1      CMD16(0x0090, 0x0010);           
 539   1      CMD16(0x0092, 0x0000);           
 540   1      CMD16(0x0093, 0x0003);           
 541   1      CMD16(0x0095, 0x0110);           
 542   1      CMD16(0x0097, 0x0000);           
 543   1      CMD16(0x0098, 0x0000);           
 544   1      CMD16(0x0007, 0x0173);  // 262K color and display ON     
 545   1      
 546   1      
 547   1      }
 548          
 549          void HX8312_init()
 550          {
 551   1       
C51 COMPILER V7.50   S6D0144                                                               05/29/2007 09:06:46 PAGE 10  

 552   1      RES=0;
 553   1      delay(300);
 554   1      RES=1;
 555   1      delay(100);
 556   1       
 557   1      
 558   1      CMD16(0x00E5, 0x8000);  // Set the Vcore voltage and this setting is must.       
 559   1      CMD16(0x0000, 0x0001);  // Start internal OSC.   
 560   1      CMD16(0x0001, 0x0100);  // set SS and SM bit     
 561   1      CMD16(0x0002, 0x0700);  // set 1 line inversion          
 562   1      CMD16(0x0003, 0x1030);  // set GRAM write direction and BGR=0.   
 563   1      
 564   1      CMD16(0x0004, 0x0000);  // Resize register       
 565   1      CMD16(0x0008, 0x0202);  // set the back porch and front porch    
 566   1      CMD16(0x0009, 0x0000);  // set non-display area refresh cycle ISC[3:0]   
 567   1      CMD16(0x000A, 0x0000);  // FMARK function        
 568   1      CMD16(0x000C, 0x0000);  // RGB interface setting         
 569   1      CMD16(0x000D, 0x0000); // Frame marker Position          
 570   1      CMD16(0x000F, 0x0000);  // RGB interface polarity        
 571   1      //*************Power On sequence ****************//      
 572   1      CMD16(0x0010, 0x0000);  // SAP, BT[3:0], AP, DSTB, SLP, STB      
 573   1      CMD16(0x0011, 0x0007);  // DC1[2:0], DC0[2:0], VC[2:0]   
 574   1      CMD16(0x0012, 0x0000);  // VREG1OUT voltage      
 575   1      CMD16(0x0013, 0x0000);  // VDV[4:0] for VCOM amplitude   
 576   1      delay(200);     // Dis-charge capacitor power voltage    
 577   1      CMD16(0x0010, 0x17B0);  // SAP, BT[3:0], AP, DSTB, SLP, STB      
 578   1      CMD16(0x0011, 0x0007);  // DC1[2:0], DC0[2:0], VC[2:0]   
 579   1      delay(50);      // Delay 50ms    
 580   1      CMD16(0x0012, 0x013E);  // VREG1OUT voltage      
 581   1      delay(50);      // Delay 50ms    
 582   1      CMD16(0x0013, 0x1F00);  // VDV[4:0] for VCOM amplitude   
 583   1      CMD16(0x0029, 0x0013);  // VCM[4:0] for VCOMH    
 584   1      delay(50);               
 585   1      CMD16(0x0020, 0x0000);  // GRAM horizontal Address       
 586   1      CMD16(0x0021, 0x0000);  // GRAM Vertical Address         
 587   1      // ----------- Adjust the Gamma         Curve ----------//               
 588   1      CMD16(0x0030, 0x0000);           
 589   1      CMD16(0x0031, 0x0404);           
 590   1      CMD16(0x0032, 0x0404);           
 591   1      CMD16(0x0035, 0x0004);           
 592   1      CMD16(0x0036, 0x0404);           
 593   1      CMD16(0x0037, 0x0404);           
 594   1      CMD16(0x0038, 0x0404);           
 595   1      CMD16(0x0039, 0x0707);           
 596   1      CMD16(0x003C, 0x0500);           
 597   1      CMD16(0x003D, 0x0607);           
 598   1      //------------------ Set GRAM area ---------------//             
 599   1      CMD16(0x0050, 0x0000);  // Horizontal GRAM Start Address         
 600   1      
 601   1      CMD16(0x0051, 0x00EF);  // Horizontal GRAM End Address   
 602   1      CMD16(0x0052, 0x0000);  // Vertical GRAM Start Address   
 603   1      CMD16(0x0053, 0x013F);  // Vertical GRAM Start Address   
 604   1      CMD16(0x0060, 0x2700);  // Gate Scan Line        
 605   1      CMD16(0x0061, 0x0001);  // NDL,VLE, REV          
 606   1      CMD16(0x006A, 0x0000);  // set scrolling line    
 607   1      //-------------- Partial Display Control ---------//             
 608   1      CMD16(0x0080, 0x0000);           
 609   1      CMD16(0x0081, 0x0000);           
 610   1      CMD16(0x0082, 0x0000);           
 611   1      CMD16(0x0083, 0x0000);           
 612   1      CMD16(0x0084, 0x0000);           
 613   1      CMD16(0x0085, 0x0000);           
C51 COMPILER V7.50   S6D0144                                                               05/29/2007 09:06:46 PAGE 11  

 614   1      //-------------- Panel Control -------------------//             
 615   1      CMD16(0x0090, 0x0010);           
 616   1      CMD16(0x0092, 0x0000);           
 617   1      CMD16(0x0093, 0x0003);           
 618   1      CMD16(0x0095, 0x0110);           
 619   1      CMD16(0x0097, 0x0000);           
 620   1      CMD16(0x0098, 0x0000);           
 621   1      CMD16(0x0007, 0x0173);  // 262K color and display ON     
 622   1      delay(50);
 623   1      }                
 624          
 625          
 626          void W_D(uchar h,uchar l)
 627          {
 628   1      
 629   1      RS=1;
 630   1      _CS=0;
 631   1      OUTPORT_H=h;
 632   1       
 633   1      OUTPORT_L=l;
 634   1      _WR=0;
 635   1      _WR=1;
 636   1      _CS=1;
 637   1      }
 638           
 639          void W_D2(uint ua)
 640          {
 641   1      uchar aa;
 642   1      RS=1;//==>Data
 643   1      _CS=0;
 644   1      aa=(unsigned char)(ua>>8);
 645   1      OUTPORT_H=aa;//
 646   1      
 647   1      OUTPORT_L=(unsigned char)ua;//
 648   1      
 649   1      _WR=0;
 650   1      _WR=1;
 651   1      _CS=1;
 652   1      
 653   1      }
 654          
 655          void CMD16(unsigned char a,unsigned int b)
 656          {
 657   1      W_C(a);
 658   1      W_D2(b);
 659   1      }
 660           
 661          void W_C(unsigned char ua)
 662          {
 663   1      RS=0;//==>Command
 664   1       
 665   1      _CS=0;
 666   1      OUTPORT_H=0;//
 667   1      OUTPORT_L=ua;//
 668   1      _WR=0;
 669   1      _WR=1;
 670   1      _CS=1;
 671   1      
 672   1      }
 673          
 674          
 675          void set_pixel(unsigned char x,unsigned int y)
C51 COMPILER V7.50   S6D0144                                                               05/29/2007 09:06:46 PAGE 12  

 676          {
 677   1      if(x>=240)x=240-1;
 678   1      if(y>=320)y=320-1;
 679   1      
 680   1      W_C(0x20);
 681   1      W_D2(x);
 682   1      W_C(0x21);
 683   1      W_D2(y);
 684   1      
 685   1      W_C(0X22);
 686   1      
 687   1      W_D(0xff,0xff);
 688   1      }
 689          
 690          void test_pixel2()
 691          {
 692   1      unsigned int a;
 693   1      for(a=0;a<320;a++)
 694   1      {
 695   2      if(a<240)
 696   2      {
 697   3      W_C(0x20);
 698   3      W_D2(a);
 699   3      }
 700   2      else
 701   2      {
 702   3      W_C(0x20);
 703   3      W_D2(120);
 704   3      }
 705   2      W_C(0x21);
 706   2      W_D2(a);
 707   2      
 708   2      W_C(0X22);
 709   2      
 710   2      W_D(0xff,0xff);
 711   2      }
 712   1      
 713   1      }
 714          
 715          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   2450    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     24      28
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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