刚刚调试出来,现在可以支持ILI9331驱动IC的液晶屏了.目前ALIENTEK STM32开发板所实际测试可以支持的液晶IC型号有:9320,9325,9328,9331,5408,1505,1289,4531.总共8款之多!
大家只要把下面的初始化代码加入到液晶初始化函数里面,就可以支持9331的液晶了.
else if(DeviceCode==0X9331)
{
LCD_WriteReg(0x00E7, 0x1014);
LCD_WriteReg(0x0001, 0x0100); // set SS and SM bit
LCD_WriteReg(0x0002, 0x0200); // set 1 line inversion
LCD_WriteReg(0x0003,(1<<12)|(3<<4)|(0<<3));//65K
//LCD_WriteReg(0x0003, 0x1030); // set GRAM write direction and BGR=1.
LCD_WriteReg(0x0008, 0x0202); // set the back porch and front porch
LCD_WriteReg(0x0009, 0x0000); // set non-display area refresh cycle ISC[3:0]
LCD_WriteReg(0x000A, 0x0000); // FMARK function
LCD_WriteReg(0x000C, 0x0000); // RGB interface setting
LCD_WriteReg(0x000D, 0x0000); // Frame marker Position
LCD_WriteReg(0x000F, 0x0000); // RGB interface polarity
//*************Power On sequence ****************//
LCD_WriteReg(0x0010, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB
LCD_WriteReg(0x0011, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0]
LCD_WriteReg(0x0012, 0x0000); // VREG1OUT voltage
LCD_WriteReg(0x0013, 0x0000); // VDV[4:0] for VCOM amplitude
delay_ms(200); // Dis-charge capacitor power voltage
LCD_WriteReg(0x0010, 0x1690); // SAP, BT[3:0], AP, DSTB, SLP, STB
LCD_WriteReg(0x0011, 0x0227); // DC1[2:0], DC0[2:0], VC[2:0]
delay_ms(50); // Delay 50ms
LCD_WriteReg(0x0012, 0x000C); // Internal reference voltage= Vci;
delay_ms(50); // Delay 50ms
LCD_WriteReg(0x0013, 0x0800); // Set VDV[4:0] for VCOM amplitude
LCD_WriteReg(0x0029, 0x0011); // Set VCM[5:0] for VCOMH
LCD_WriteReg(0x002B, 0x000B); // Set Frame Rate
delay_ms(50); // Delay 50ms
LCD_WriteReg(0x0020, 0x0000); // GRAM horizontal Address
LCD_WriteReg(0x0021, 0x013f); // GRAM Vertical Address
// ----------- Adjust the Gamma Curve ----------//
LCD_WriteReg(0x0030, 0x0000);
LCD_WriteReg(0x0031, 0x0106);
LCD_WriteReg(0x0032, 0x0000);
LCD_WriteReg(0x0035, 0x0204);
LCD_WriteReg(0x0036, 0x160A);
LCD_WriteReg(0x0037, 0x0707);
LCD_WriteReg(0x0038, 0x0106);
LCD_WriteReg(0x0039, 0x0707);
LCD_WriteReg(0x003C, 0x0402);
LCD_WriteReg(0x003D, 0x0C0F);
//------------------ Set GRAM area ---------------//
LCD_WriteReg(0x0050, 0x0000); // Horizontal GRAM Start Address
LCD_WriteReg(0x0051, 0x00EF); // Horizontal GRAM End Address
LCD_WriteReg(0x0052, 0x0000); // Vertical GRAM Start Address
LCD_WriteReg(0x0053, 0x013F); // Vertical GRAM Start Address
LCD_WriteReg(0x0060, 0x2700); // Gate Scan Line
LCD_WriteReg(0x0061, 0x0001); // NDL,VLE, REV
LCD_WriteReg(0x006A, 0x0000); // set scrolling line
//-------------- Partial Display Control ---------//
LCD_WriteReg(0x0080, 0x0000);
LCD_WriteReg(0x0081, 0x0000);
LCD_WriteReg(0x0082, 0x0000);
LCD_WriteReg(0x0083, 0x0000);
LCD_WriteReg(0x0084, 0x0000);
LCD_WriteReg(0x0085, 0x0000);
//-------------- Panel Control -------------------//
LCD_WriteReg(0x0090, 0x0010);
LCD_WriteReg(0x0092, 0x0600);
LCD_WriteReg(0x0007, 0x0133); // 262K color and display ON
} |