牛逼4寸高清屏,320*480分辨率,全视角,信利原厂A规,支持8位/16位/9位/18位数据接口,
支持SPI接口,提供8位,16位,SPI程序!
4个IO就可以驱动320*480的高分液晶屏,牛逼的很!!!!!
适合任何单片机驱动,速度快,IO多可以支持使用8/16位接口;IO不够情况下直接可以使用SPI接口!
秀液晶屏和模块图片:
先上驱动IC手册:
ILI9481DS_V0.26.pdf (1.61 MB, 下载次数: 0)
跳线说明:
//////////////////////////////////////////////////////////////////////////////////
//SPI接口硬件接线
//PC2---S0
//PC3---SI
//PC7---WR
//PC8---RS
//PC9---CS
//RST---RESET
//PC10---BL
//IM0-IM2跳线(模块背面):IM0=1;IM1=1;IM2=1
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//8位数据硬件接线:
//PC6---RD
//PC7---WR
//PC8---RS
//PC9---CS
//PB0-PB7---D0-D7
//RST---RESET
//PC10---BL
//IM0-IM2跳线(模块背面):IM0=1;IM1=1;IM2=0
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//16位数据硬件接线:
//PC6---RD
//PC7---WR
//PC8---RS
//PC9---CS
//PB0-PB15---D0-D15
//RST---RESET
//PC10---BL
//IM0-IM2跳线(模块背面):IM0=0;IM1=1;IM2=0
//////////////////////////////////////////////////////////////////////////////////
初始化代码:
LCD_WR_REG(0x01);
delay_ms(50);
LCD_WR_REG(0x0011); //??????,0x0010??? ILI9481
delay_ms(20);
LCD_WR_REG(0x0013); //????????
LCD_WR_REG(0x00D0); //??????,??3???
LCD_WR_DATA(0x0007); //1.0xVci
LCD_WR_DATA(0x0040); //
LCD_WR_DATA(0x001c); //
LCD_WR_REG(0x00D1); //Vcom Control ??????
LCD_WR_DATA(0x00FF); //
LCD_WR_DATA(0x00FF); // 18
LCD_WR_DATA(0x00FF); // 1D
LCD_WR_REG(0x00D2); //????????????,??????
LCD_WR_DATA(0x0001); //
LCD_WR_DATA(0x0011); //
LCD_WR_REG(0x00C0); //Panel Driving setting ??5???
LCD_WR_DATA(0x0010); //??????
LCD_WR_DATA(0x003B); //????480?
LCD_WR_DATA(0x0000); //
LCD_WR_DATA(0x0002); //5frames
LCD_WR_DATA(0x0011); //
LCD_WR_REG(0x00C1); //Timing setting ??3???
LCD_WR_DATA(0x0010); //
LCD_WR_DATA(0x0010); //LCD_WR_DATA(0x000B); //
LCD_WR_DATA(0x0088); //
LCD_WR_REG(0x00C5); //Frame Rate and Inversion Control ??????
LCD_WR_DATA(0x0001); //100hz
LCD_WR_REG(0x00C8); //????,??12???
LCD_WR_DATA(0x0000);LCD_WR_DATA(0x0030);LCD_WR_DATA(0x0036);
LCD_WR_DATA(0x0045);LCD_WR_DATA(0x0004);LCD_WR_DATA(0x0016);
LCD_WR_DATA(0x0037);LCD_WR_DATA(0x0075);LCD_WR_DATA(0x0077);
LCD_WR_DATA(0x0054);LCD_WR_DATA(0x000f);LCD_WR_DATA(0x0000);
LCD_WR_REG(0x00E4);LCD_WR_DATA(0x00A0);
LCD_WR_REG(0x00F0);LCD_WR_DATA(0x0001);
LCD_WR_REG(0x00F3);LCD_WR_DATA(0x0040);
LCD_WR_DATA(0x000A);
LCD_WR_REG(0x00F7);LCD_WR_DATA(0x0080);
LCD_WR_REG(0x0036);LCD_WR_DATA(0x000A); //LCD_WR_DATA(0x000a); //YT24F146CIS--0X00CA,CIB--0X000A
LCD_WR_REG(0x003A);LCD_WR_DATA(0x0055);
LCD_WR_REG(0x002A);
LCD_WR_DATA(0x0000);
LCD_WR_DATA(0x0000);
LCD_WR_DATA(0x0001);
LCD_WR_DATA(0x003F);
LCD_WR_REG(0x002B);
LCD_WR_DATA(0x0000);
LCD_WR_DATA(0x0000);
LCD_WR_DATA(0x0001);
LCD_WR_DATA(0x00df);
delay_ms(50);
//LCD_WR_REG(0x0021);
LCD_WR_REG(0x0029);
LCD_WR_REG(0x002C);
另外一款4.3寸高分屏的模块,SSD1963驱动,分辨率480*800(一般4.3寸是480*272):
初始化代码:
while(1)
{
Check = 1;
LCD_WR_REG(0xE2); //Set PLL with OSC = 10MHz (hardware), Multiplier N = 35, 250MHz < VCO < 800MHz = OSC*(N+1), VCO = 360MHz
LCD_WR_DATA(0x23); //²ÎÊý1
LCD_WR_DATA(0x02); //²ÎÊý2 Divider M = 2, PLL = 360/(M+1) = 120MHz
LCD_WR_DATA(0x54); //²ÎÊý3 Validate M and N values
LCD_WR_REG(0xE0); // Start PLL command
LCD_WR_DATA(0x01); // enable PLL
delay_nms(2);
LCD_WR_REG(0xE0); // Start PLL command again
LCD_WR_DATA(0x03);
delay_nms(10);
LCD_WR_REG(0xe4);
Para[0] = LCD_RD_DATA();
if(Para[0] != 0x04) Check = 0;
LCD_WR_REG(0xe3);
Para[0] = LCD_RD_DATA();
Para[1] = LCD_RD_DATA();
Para[2] = LCD_RD_DATA();
printf("e30=%x\n",Para[0]);
printf("e31=%x\n",Para[1]);
printf("e32=%x\n",Para[2]);
if(Para[0] != 0x23) Check = 0;
if(Para[1] != 0x02) Check = 0;
if(Para[2] != 0x04) Check = 0;
if(Check) break;
}
LCD_WR_REG(0x01); //Èí¸´Î»
delay_nms(10);
//Set LSHIFT freq, i.e. the DCLK with PLL freq 120MHz set previously
//Typical DCLK for TY700TFT800480 is 33.3MHz(datasheet), experiment shows 30MHz gives a stable result
//30MHz = 120MHz*(LCDC_FPR+1)/2^20
//LCDC_FPR = 262143 (0x3FFFF)
//Time per line = (DISP_HOR_RESOLUTION+DISP_HOR_PULSE_WIDTH+DISP_HOR_BACK_PORCH+DISP_HOR_FRONT_PORCH)/30 us = 1056/30 = 35.2us
while(1)
{
Check = 1;
LCD_WR_REG(0xE6);
LCD_WR_DATA(0x03);
LCD_WR_DATA(0xff);
LCD_WR_DATA(0xff);
LCD_WR_REG(0xE7);
Para[0] = LCD_RD_DATA();
Para[1] = LCD_RD_DATA();
Para[2] = LCD_RD_DATA();
if(Para[0] != 0x03) Check = 0;
if(Para[1] != 0xff) Check = 0;
if(Para[2] != 0xff) Check = 0;
if(Check) break;
}
//Set LCD mode, varies from individual manufacturer
while(1)
{
Check = 1;
LCD_WR_REG(0xB0);
LCD_WR_DATA(0x20);//0x10 // set 24-bit
LCD_WR_DATA(0x80); // set TTL mode
LCD_WR_DATA((DISP_HOR_RESOLUTION-1)>>8); // Set LCD panel size(DISP_HOR_RESOLUTION = 800) H
LCD_WR_DATA(DISP_HOR_RESOLUTION-1); // Set LCD panel size(DISP_HOR_RESOLUTION = 800) L
LCD_WR_DATA((DISP_VER_RESOLUTION-1)>>8); // Set LCD panel size(DISP_VER_RESOLUTION = 480) H
LCD_WR_DATA(DISP_VER_RESOLUTION-1); // Set LCD panel size(DISP_VER_RESOLUTION = 480) L
LCD_WR_DATA(0x00);//0x00 // RGB sequence
LCD_WR_REG(0xB1);
Para[0] = LCD_RD_DATA();
Para[1] = LCD_RD_DATA();
Para[2] = LCD_RD_DATA();
Para[3] = LCD_RD_DATA();
Para[4] = LCD_RD_DATA();
Para[5] = LCD_RD_DATA();
Para[6] = LCD_RD_DATA();
if(Para[0] != 0x20) Check = 0;
if(Para[1] != 0x80) Check = 0;
if(Para[2] != ((DISP_HOR_RESOLUTION-1)>>8)) Check = 0;
if(Para[3] != ((DISP_HOR_RESOLUTION-1)&0xff)) Check = 0;
if(Para[4] != ((DISP_VER_RESOLUTION-1)>>8)) Check = 0;
if(Para[5] != ((DISP_VER_RESOLUTION-1)&0xff)) Check = 0;
if(Para[6] != 0x00) Check = 0;
if(Check) break;
}
//Set horizontal period
while(1)
{
LCD_WR_REG(0xB4);
LCD_WR_DATA((HT-1)>>8);
LCD_WR_DATA(HT-1);
LCD_WR_DATA((HPS-1)>>8);
LCD_WR_DATA(HPS-1);
LCD_WR_DATA(DISP_HOR_PULSE_WIDTH-1);
LCD_WR_DATA(0x00);
LCD_WR_DATA(0x00);
LCD_WR_DATA(0x00);
LCD_WR_REG(0xB5);
Para[0] = LCD_RD_DATA();
Para[1] = LCD_RD_DATA();
Para[2] = LCD_RD_DATA();
Para[3] = LCD_RD_DATA();
Para[4] = LCD_RD_DATA();
Para[5] = LCD_RD_DATA();
Para[6] = LCD_RD_DATA();
Para[7] = LCD_RD_DATA();
if(Para[0] != ((HT-1)>>8)) Check = 0;
if(Para[1] != ((HT-1)&0xff)) Check = 0;
if(Para[2] != ((HPS-1)>>8)) Check = 0;
if(Para[3] != ((HPS-1)&0xff)) Check = 0;
if(Para[4] != DISP_HOR_PULSE_WIDTH-1) Check = 0;
if(Para[5] != 0x00) Check = 0;
if(Para[6] != 0x00) Check = 0;
if(Para[7] != 0x00) Check = 0;
if(Check) break;
}
//Set vertical period
while(1)
{
LCD_WR_REG(0xB6);
LCD_WR_DATA((VT-1)>>8);
LCD_WR_DATA(VT-1);
LCD_WR_DATA((VSP-1)>>8);
LCD_WR_DATA(VSP-1);
LCD_WR_DATA(DISP_VER_PULSE_WIDTH-1);
LCD_WR_DATA(0x00);
LCD_WR_DATA(0x00);
LCD_WR_REG(0xB7);
Para[0] = LCD_RD_DATA();
Para[1] = LCD_RD_DATA();
Para[2] = LCD_RD_DATA();
Para[3] = LCD_RD_DATA();
Para[4] = LCD_RD_DATA();
Para[5] = LCD_RD_DATA();
Para[6] = LCD_RD_DATA();
if(Para[0] != ((VT-1)>>8)) Check = 0;
if(Para[1] != ((VT-1)&0xff)) Check = 0;
if(Para[2] != ((VSP-1)>>8)) Check = 0;
if(Para[3] != ((VSP-1)&0xff)) Check = 0;
if(Para[4] != DISP_VER_PULSE_WIDTH-1) Check = 0;
if(Para[5] != 0x00) Check = 0;
if(Para[6] != 0x00) Check = 0;
if(Check) break;
}
while(1)
{
Check = 1;
LCD_WR_REG(0xf0); //ÉèÖÃSSD1963ͬCPU½Ó¿ÚΪ16bit Set pixel data interface
LCD_WR_DATA(0x03); //16-bit(565 format) data for 16bpp PIC32MX only
LCD_WR_REG(0xf1); //Set pixel format
Para[0] = LCD_RD_DATA();
if(Para[0] != 0x03) Check = 0;
if(Check) break;
}
LCD_Clear(White);
LCD_WR_REG(0x29); // Turn on display; show the image on display
//LCD_WR_REG(0x29);
LCD_WR_REG(0xB8); //ÉèÖÃGPIOÅäÖÃ
LCD_WR_DATA(0x0F); //GPIO is controlled by host; 4¸öIOÉèÖóÉÊä³ö
LCD_WR_DATA(0x01); //GPIO0 ʹÓÃÕý³£µÄIO¹¦ÄÜ
最后一款完全兼容(程序直接使用)战舰和MINI开发板的4寸480*320高清模块,带完美触摸屏: