给段8347g的代码给你,肯定可以用,希望对你有帮助。
void TM_HX8347_G_Init(void)
{
Delayms(50); /* delay 50 ms */
//Start initial Sequence
LCD_WriteReg(0x002E,0x0089); //GDOFF
LCD_WriteReg(0x0029,0x008f); //RTN
LCD_WriteReg(0x002b,0x0002); //DUM
LCD_WriteReg(0x00e2,0x0006); //VREF
LCD_WriteReg(0x00e4,0x0001); //PTBA[15:8]
LCD_WriteReg(0x00e5,0x0010); //PTBA[7:0]
LCD_WriteReg(0x00e6,0x0001); //STBA[15:8]
LCD_WriteReg(0x00e7,0x0010); //STBA[7:0]
LCD_WriteReg(0x00e8,0x0070); //OPON[7:0]
LCD_WriteReg(0x00f2,0x0000); //GEN
//Driving abiliSetting
LCD_WriteReg(0x00ea,0x0000); //PTBA[15:8]
LCD_WriteReg(0x00eb,0x0020); //PTBA[7:0]
LCD_WriteReg(0x00ec,0x003c); //STBA[15:8]
LCD_WriteReg(0x00ed,0x00c8); //STBA[7:0]
LCD_WriteReg(0x00e9,0x0038); //OPON1[7:0]
LCD_WriteReg(0x00f1,0x0001); //OTPS1B
//Gamma 2.2 Setting
LCD_WriteReg(0x0040,0x0002); //0x01
LCD_WriteReg(0x0041,0x0007); //0x01
LCD_WriteReg(0x0042,0x0000); //0x01
LCD_WriteReg(0x0043,0x0010); //0x01
LCD_WriteReg(0x0044,0x000c); //0x01
LCD_WriteReg(0x0045,0x002b); //0x01
LCD_WriteReg(0x0046,0x0001); //0x01
LCD_WriteReg(0x0047,0x004e); //0x01
LCD_WriteReg(0x0048,0x0001); //0x01
LCD_WriteReg(0x0049,0x0013); //0x01
LCD_WriteReg(0x004a,0x0018); //0x01
LCD_WriteReg(0x004b,0x0018); //0x01
LCD_WriteReg(0x004c,0x0016); //0x01
LCD_WriteReg(0x0050,0x0014); //0x01
LCD_WriteReg(0x0051,0x0033); //0x01
LCD_WriteReg(0x0052,0x002f); //0x01
LCD_WriteReg(0x0053,0x003f); //0x01
LCD_WriteReg(0x0054,0x0038); //0x01
LCD_WriteReg(0x0055,0x003d); //0x01
LCD_WriteReg(0x0056,0x0031); //0x01
LCD_WriteReg(0x0057,0x007e); //0x01
LCD_WriteReg(0x0058,0x0009); //0x01
LCD_WriteReg(0x0059,0x0007); //0x01
LCD_WriteReg(0x005a,0x0007); //0x01
LCD_WriteReg(0x005b,0x000c); //0x01
LCD_WriteReg(0x005c,0x001e); //0x01
LCD_WriteReg(0x005d,0x00cc); //0x01
CMD->LCD_REG=0x21;
LCD_WriteReg(0x001B,0x001B); //VRH=4.65V
LCD_WriteReg(0x001A,0x0002); //BT (VGH~15V),WriteData(VGL~-7V),WriteData(DDVDH~5V)
LCD_WriteReg(0x24,0x0044); //VMH(VCOM High voltage ~4.0V) 0x61 //46
LCD_WriteReg(0x25,0x0060); //VML(VCOM Low voltage -1.0V) 0x5e //64
LCD_WriteReg(0x23,0x00a2); //for Flicker adjust //can reload from OTP /A0
//Power on Sett
LCD_WriteReg(0x18,0x0037); //I/P_RADJ),WriteData(N/P_RADJ),WriteData( Normal mode 75Hz
LCD_WriteReg(0x19,0x0001); //OSC_EN='1'),WriteData( start Osc
LCD_WriteReg(0x01,0x0000); //DP_STB='0'),WriteData( out deep sleep
LCD_WriteReg(0x1F,0x0088); //GAS=1),WriteData( VOMG=00),WriteData( PON=0),WriteData( DK=1),WriteData( XDK=0),WriteData( DVDH_TRI=0),WriteData( STB=0
Delayms(5);
LCD_WriteReg(0x1F,0x0080); //GAS=1),WriteData( VOMG=00),WriteData( PON=0),WriteData( DK=0),WriteData( XDK=0),WriteData( DVDH_TRI=0),WriteData( STB=0
Delayms(5);
LCD_WriteReg(0x1F,0x0090); //GAS=1),WriteData( VOMG=00),WriteData( PON=1),WriteData( DK=0),WriteData( XDK=0),WriteData( DVDH_TRI=0),WriteData( STB=0
Delayms(5);
LCD_WriteReg(0x1F,0x00D4); //GAS=1),WriteData( VOMG=10),WriteData( PON=1),WriteData( DK=0),WriteData( XDK=1),WriteData( DDVDH_TRI=0),WriteData( STB=0
Delayms(5);
//262k/65k color
//LCD_WriteReg(0x17,0x0006); //default 0x06 262k color // 0x05 65k color
LCD_WriteReg(0x17,0x0055); //default 0x06 262k color // 0x05 65k color
//SET PANEL
/*******************RGB****************************/
/*WriteCommand(0x31),WriteData(0x0002);//RGB
WriteCommand(0x32),WriteData(0x0000);*/
LCD_WriteReg(0x36,0x0009); //SS_P),WriteData( GS_P),WriteData(REV_P),WriteData(BGR_P
//Display ON Set
LCD_WriteReg(0x28,0x0038); //GON=1),WriteData( DTE=1),WriteData( D=1000
Delayms(40);
LCD_WriteReg(0x28,0x003F); //GON=1),WriteData( DTE=1),WriteData( D=1100
} |