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

📄 lcd.c

📁 ILI9320的驱动在手机上使用过并已经生产
💻 C
📖 第 1 页 / 共 4 页
字号:
  WMLCDCOM(0x0030); WMLCDDATA(0x0707);
  WMLCDCOM(0x0031); WMLCDDATA(0x0407);
  WMLCDCOM(0x0032); WMLCDDATA(0x0203);
  WMLCDCOM(0x0033); WMLCDDATA(0x0303);
  WMLCDCOM(0x0034); WMLCDDATA(0x0303);
  WMLCDCOM(0x0035); WMLCDDATA(0x0202);
  WMLCDCOM(0x0036); WMLCDDATA(0x001F);
  WMLCDCOM(0x0037); WMLCDDATA(0x0707);
  WMLCDCOM(0x0038); WMLCDDATA(0x0407);
  WMLCDCOM(0x0039); WMLCDDATA(0x0203);
  WMLCDCOM(0x003A); WMLCDDATA(0x0303);
  WMLCDCOM(0x003B); WMLCDDATA(0x0303);
  WMLCDCOM(0x003C); WMLCDDATA(0x0202);
  WMLCDCOM(0x003D); WMLCDDATA(0x001F);

  WMLCDCOM(0x0020); WMLCDDATA(0x0000);
  WMLCDCOM(0x0021); WMLCDDATA(0x0000);
  delayms(50);
  WMLCDCOM(0x0022);
#endif

#if 0    //9320
  TFT_writec(0x0007);
  TFT_writed(0x0032);
  TFT_writec(0x0007);
  TFT_writed(0x0000);    
  TFT_writec(0x0010);
  TFT_writed(0x0000);    
  TFT_writec(0x0012);
  TFT_writed(0x0000);
  delayms(200); 

//************* Start Initial Sequence **********//
  TFT_writec(0x00E5);
  TFT_writed(0x8000);
  TFT_writec(0x0000);
  TFT_writed(0x0001);    // Start internal OSC.
  TFT_writec(0x0001);
  TFT_writed(0x0100);    // set SS and SM bit
  TFT_writec(0x0002);
  TFT_writed(0x0700);    // set 1 line inversion
  TFT_writec(0x0003);
  TFT_writed(0x1030);    // set GRAM write direction and BGR=1. 
  TFT_writec(0x0004);
  TFT_writed(0x0000);    // Resize register
  TFT_writec(0x0008);
  TFT_writed(0x0202);    // set the back porch and front porch
  TFT_writec(0x0009);
  TFT_writed(0x0000);    // set non-display area refresh cycle ISC[3:0]
  TFT_writec(0x000A);
  TFT_writed(0x0000);    // FMARK function
  TFT_writec(0x000C);
  TFT_writed(0x0000);    // RGB interface setting
  TFT_writec(0x000D);
  TFT_writed(0x0000);    // Frame marker Position
  TFT_writec(0x000F);
  TFT_writed(0x0000);    // RGB interface polarity

//*************Power On sequence ****************//
  TFT_writec(0x0010);
  TFT_writed(0x0000);    
  TFT_writec(0x0011);
  TFT_writed(0x0007);    
  TFT_writec(0x0012);
  TFT_writed(0x0000);    
  TFT_writec(0x0013);
  TFT_writed(0x0000);  
	delayms(200);
  TFT_writec(0x0010);
  TFT_writed(0x17B0);    // SAP, BT[3:0], AP, DSTB, SLP, STB
  TFT_writec(0x0011);
  TFT_writed(0x0007);    // DC1[2:0], DC0[2:0], VC[2:0]
	delayms(50);
  TFT_writec(0x0012);
  TFT_writed(0x011D);    // VREG1OUT voltage
	delayms(50);
  TFT_writec(0x0013);
  TFT_writed(0x1500);    // VDV[4:0] for VCOM amplitude
  TFT_writec(0x0029);
  TFT_writed(0x0009);    // VCM[4:0] for VCOMH
	delayms(50);

//gamma function

  TFT_writec(0x0030);
  TFT_writed(0x0000);
  TFT_writec(0x0031);
  TFT_writed(0x0404);
  TFT_writec(0x0032);
  TFT_writed(0x0404);
  TFT_writec(0x0035);
  TFT_writed(0x0004);
  TFT_writec(0x0036);
  TFT_writed(0x0404);
  TFT_writec(0x0037);
  TFT_writed(0x0404);  
  TFT_writec(0x0038);
  TFT_writed(0x0404);  
  TFT_writec(0x0039);
  TFT_writed(0x0707);  
  TFT_writec(0x003C);
  TFT_writed(0x0500);
  TFT_writec(0x003D);
  TFT_writed(0x0607);


//------------------ Set GRAM area ---------------//
  TFT_writec(0x0050);
  TFT_writed(0x0000);    // Horizontal GRAM Start Address
  TFT_writec(0x0051);
  TFT_writed(0x00EF);    // Horizontal GRAM End Address
  TFT_writec(0x0052);
  TFT_writed(0x0000);    // Vertical GRAM Start Address
  TFT_writec(0x0053);
  TFT_writed(0x013F);    // Vertical GRAM Start Address
  TFT_writec(0x0060);
  TFT_writed(0x2700);    // Gate Scan Line
  TFT_writec(0x0061);
  TFT_writed(0x0001);    // NDL,VLE, REV
  TFT_writec(0x006A);
  TFT_writed(0x0000);    // set scrolling line
 
//-------------- Partial Display Control ---------//  
  TFT_writec(0x0080);
  TFT_writed(0x0000);
  TFT_writec(0x0081);
  TFT_writed(0x0000);
  TFT_writec(0x0082);
  TFT_writed(0x0000);
  TFT_writec(0x0083);
  TFT_writed(0x0000);
  TFT_writec(0x0084);
  TFT_writed(0x0000);
  TFT_writec(0x0085);
  TFT_writed(0x0000);

//-------------- Panel Control -------------------//
  TFT_writec(0x0090);
  TFT_writed(0x0015);
  TFT_writec(0x0092);
  TFT_writed(0x0000);
  TFT_writec(0x0093);
  TFT_writed(0x0003);
  TFT_writec(0x0095);
  TFT_writed(0x0110);
  TFT_writec(0x0097);
  TFT_writed(0x0000);
  TFT_writec(0x0098);
  TFT_writed(0x0000);

//********** display on function **************//
  TFT_writec(0x0007);
  TFT_writed(0x0022);
	delayms(30);
  TFT_writec(0x0007);
  TFT_writed(0x0133);
//************* write to GRAM *****************//
  TFT_writec(0x0020);
  TFT_writed(0x0000);
  TFT_writec(0x0021);
  TFT_writed(0x0000);
  TFT_writec(0x0022);  //16 bit
#endif
#if (defined(BENC_HX8312_WEIJIN))
       delayms(60);		
	LCD_CtrlWrite_HX8312A(0x0100);
       LCD_CtrlWrite_HX8312A(0x0080);
       LCD_CtrlWrite_HX8312A(0x0301);
       delayms(80);                                 
       LCD_CtrlWrite_HX8312A(0x0300);
       LCD_CtrlWrite_HX8312A(0x2B00);	   
       LCD_CtrlWrite_HX8312A(0x281B);
       LCD_CtrlWrite_HX8312A(0x1A05);     
       LCD_CtrlWrite_HX8312A(0x2505);
       LCD_CtrlWrite_HX8312A(0x1C73);
       LCD_CtrlWrite_HX8312A(0x19b4);
       LCD_Delay(10);    	
       LCD_CtrlWrite_HX8312A(0x18C1);
	delayms(80);
       LCD_CtrlWrite_HX8312A(0x1E00);
       LCD_CtrlWrite_HX8312A(0x18C5);
       LCD_CtrlWrite_HX8312A(0x18E5);
	delayms(60);
       LCD_CtrlWrite_HX8312A(0x18F5);
	delayms(50);
       LCD_CtrlWrite_HX8312A(0x1B0d);
	delayms(60);
       LCD_CtrlWrite_HX8312A(0x2012);
       LCD_CtrlWrite_HX8312A(0x1F16);
       LCD_CtrlWrite_HX8312A(0x1E81);
       delayms(80);    
       LCD_CtrlWrite_HX8312A(0x9D00);
       LCD_CtrlWrite_HX8312A(0xC000);
       LCD_CtrlWrite_HX8312A(0x0E00);
       LCD_CtrlWrite_HX8312A(0x0F00);
       LCD_CtrlWrite_HX8312A(0x1000);
       LCD_CtrlWrite_HX8312A(0x1100);
       LCD_CtrlWrite_HX8312A(0x1200);
       LCD_CtrlWrite_HX8312A(0x1300);
       LCD_CtrlWrite_HX8312A(0x1400);
       LCD_CtrlWrite_HX8312A(0x1500);
       LCD_CtrlWrite_HX8312A(0x1600);
       LCD_CtrlWrite_HX8312A(0x1700);	   
       LCD_CtrlWrite_HX8312A(0x3401);
       LCD_CtrlWrite_HX8312A(0x3500);	   
       LCD_CtrlWrite_HX8312A(0x4B00);
       LCD_CtrlWrite_HX8312A(0x4C00);
       LCD_CtrlWrite_HX8312A(0x4E00);
       LCD_CtrlWrite_HX8312A(0x4F00);
       LCD_CtrlWrite_HX8312A(0x5000);
       LCD_CtrlWrite_HX8312A(0x3C00);
       LCD_CtrlWrite_HX8312A(0x3D00);
       LCD_CtrlWrite_HX8312A(0x3E01);
       LCD_CtrlWrite_HX8312A(0x3F3F);	   
       LCD_CtrlWrite_HX8312A(0x4002);
       LCD_CtrlWrite_HX8312A(0x4102);
       LCD_CtrlWrite_HX8312A(0x4200);
       LCD_CtrlWrite_HX8312A(0x4300);
       LCD_CtrlWrite_HX8312A(0x4400);                                
       LCD_CtrlWrite_HX8312A(0x4500);
       LCD_CtrlWrite_HX8312A(0x46ef);
       LCD_CtrlWrite_HX8312A(0x4700);
       LCD_CtrlWrite_HX8312A(0x4800);
       LCD_CtrlWrite_HX8312A(0x4901);
       LCD_CtrlWrite_HX8312A(0x4A3f);
       LCD_CtrlWrite_HX8312A(0x1D00);
       LCD_CtrlWrite_HX8312A(0x8600);
       LCD_CtrlWrite_HX8312A(0x872F);
       LCD_CtrlWrite_HX8312A(0x8802);
       LCD_CtrlWrite_HX8312A(0x8905);
       LCD_CtrlWrite_HX8312A(0x8D01);
       LCD_CtrlWrite_HX8312A(0x8B36);
       LCD_CtrlWrite_HX8312A(0x3301);
       LCD_CtrlWrite_HX8312A(0x3701);
       LCD_CtrlWrite_HX8312A(0x7600);	   
       LCD_CtrlWrite_HX8312A(0x8F00);
       LCD_CtrlWrite_HX8312A(0x9077);
       LCD_CtrlWrite_HX8312A(0x9107);
       LCD_CtrlWrite_HX8312A(0x9254);
       LCD_CtrlWrite_HX8312A(0x9307);
       LCD_CtrlWrite_HX8312A(0x9400);
       LCD_CtrlWrite_HX8312A(0x9577);
       LCD_CtrlWrite_HX8312A(0x9645);
       LCD_CtrlWrite_HX8312A(0x9700);
       LCD_CtrlWrite_HX8312A(0x9806);                                  
       LCD_CtrlWrite_HX8312A(0x9903);
       LCD_CtrlWrite_HX8312A(0x9A00);
	LCD_Delay(30);
       LCD_CtrlWrite_HX8312A(0x3B01);
       LCD_Delay(30);
	LCD_CtrlWrite_HX8312A(0x0020);
	LCD_CtrlWrite_HX8312A(0x0140);
//	LCD_ClearAll_HX8312A(bkground);	

#elif(defined(BNC_IL9320_WUZHOU))
   //------------ display off function -----------//
  LCD_set_reg(0x0007,0x0032);
  delayms(30);
  LCD_set_reg(0x0007,0x0000);
  LCD_set_reg(0x0010,0x0000);
  LCD_set_reg(0x0012,0x0000);
  
  //------- power & chip setting function -------//
  LCD_set_reg(0x00E5,0x8000);
  LCD_set_reg(0x0000,0x0001);
  LCD_set_reg(0x002B,0x0010);//100HZ 2
  LCD_set_reg(0x0001,0x0100);
  LCD_set_reg(0x0002,0x0700);
  LCD_set_reg(0x0003,0x1030);
  LCD_set_reg(0x0004,0x0000);
  LCD_set_reg(0x0008,0x0202);
  LCD_set_reg(0x0009,0x0000);
  LCD_set_reg(0x000A,0x0000);
  LCD_set_reg(0x000C,0x0000);
  LCD_set_reg(0x000D,0x0000);
  LCD_set_reg(0x000F,0x0000);
//-------------Power On sequence --------------//
  LCD_set_reg(0x0010,0x0000);
  LCD_set_reg(0x0011,0x0007);
  LCD_set_reg(0x0012,0x0000);
  LCD_set_reg(0x0013,0x0000);
  delayms(200);

  LCD_set_reg(0x0010,0x17B0);
  LCD_set_reg(0x0011,0x0227);//07  037
   delayms(50);
  LCD_set_reg(0x0012,0x013c);//11d
  delayms(50);
  #if defined(wei_jin_LCD2)   //  第二个
  LCD_set_reg(0x0013,0x1A00);//19 
  LCD_set_reg(0x0029,0x000C); //0007
  #elif   defined(wei_jin_LCD1)             //第一个
  LCD_set_reg(0x0013,0x1F00);//19 
  LCD_set_reg(0x0029,0x000A); //0007
  #endif
  delayms(50);
 

  //--------------- gamma function --------------// 
  LCD_set_reg(0x0030,0x0000);  
  LCD_set_reg(0x0031,0x0404);  
  LCD_set_reg(0x0032,0x0404);
  LCD_set_reg(0x0035,0x0004);
  LCD_set_reg(0x0036,0x0404);
  LCD_set_reg(0x0037,0x0404);
  LCD_set_reg(0x0038,0x0404);
  LCD_set_reg(0x0039,0x0707);
  LCD_set_reg(0x003C,0x0500);
  LCD_set_reg(0x003D,0x0607);

  //------------- Set GRAM area -----------------//   
  LCD_set_reg(0x0050,0x0000);  
  LCD_set_reg(0x0051,0x00EF);
  LCD_set_reg(0x0052,0x0000);
  LCD_set_reg(0x0053,0x013F);
  LCD_set_reg(0x0060,0x2700);
  LCD_set_reg(0x0061,0x0001);
  LCD_set_reg(0x006A,0x0000);

  //--------- Partial Display Control -----------//
  LCD_set_reg(0x0080,0x0000);  
  LCD_set_reg(0x0081,0x0000);
  LCD_set_reg(0x0082,0x0000);
  LCD_set_reg(0x0083,0x0000);
  LCD_set_reg(0x0084,0x0000);
  LCD_set_reg(0x0085,0x0000);

  //-------------- Panel Control ----------------//
  LCD_set_reg(0x0090,0x0015);  //10
  LCD_set_reg(0x0092,0x0000);
  LCD_set_reg(0x0093,0x0003);
  LCD_set_reg(0x0095,0x0110);
  LCD_set_reg(0x0097,0x0000);
  LCD_set_reg(0x0098,0x0000);



  //------------ display on function ------------//  
  LCD_set_reg(0x0007,0x0022);
  delayms(30);
  LCD_set_reg(0x0007,0x0133);
  
  //--------------- write to GRAM ---------------// 
  LCD_set_reg(0x0020,0x0000);
  LCD_set_reg(0x0021,0x0000);
 
#endif
      #if 0
    lcd_check = 0;

	LCD_set_reg(0x0007,0x0032);//turn off power,display off
	LCD_set_reg(0x0007,0x0000);//power control 3
	LCD_set_reg(0x0010,0x0000);//power control 4
	LCD_set_reg(0x0012,0x0000);//power control 4	
	delayms(400);
	
	LCD_set_reg(0x00e5,0x8000);
	LCD_set_reg(0x0000,0x0001);
	delayms(150);
	LCD_set_reg(0x0001,0x0100);//bgr=0
	LCD_set_reg(0x0002,0x0700);
	LCD_set_reg(0x0003,0x1030);
	LCD_set_reg(0x0004,0x0000);

	LCD_set_reg(0x0008,0x0202);//bgr=0
	LCD_set_reg(0x0009,0x0700);
	LCD_set_reg(0x000a,0x0000);
	LCD_set_reg(0x000c,0x0000);
	LCD_set_reg(0x000d,0x0000);
	LCD_set_reg(0x000f,0x0000);

	/*********power setting*********/
	LCD_set_reg(0x0010,0x0000);
	LCD_set_reg(0x0011,0x0007);
	LCD_set_reg(0x0012,0x0000);//VCOMH
	LCD_set_reg(0x0013,0x0000);
	delayms(200);
	LCD_set_reg(0x0010,0x17b0);
	LCD_set_reg(0x0011,0x0007);
       delayms(50);

⌨️ 快捷键说明

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