
void LCD_GPIO_Init(void)
{
	......
//Init GPIOs for LCD	
}
void LCD_RESET(void)
{
	LCD_RST_CLR;
	delay_ms(100);	
	LCD_RST_SET;
	delay_ms(50);
}
void LCD_Init(void)
{
	LCD_GPIO_Init();//Init the GPIOs for LCD
	LCD_RESET();//You should ResetLCD before Init.

	
	//************* Start Initial Sequence **********//		
	//************* Start Initial Sequence **********//		
	LCD_WriteReg(0x2E, 0x89); //write_data(0x00,); //GDOFF
	LCD_WriteReg(0x29, 0X8F); //write_data(0x00); //RTN
	LCD_WriteReg(0x2B, 0X02); //write_data(0x00,); //DUM
	LCD_WriteReg(0xE2, 0X00); //write_data(0x00,); //VREF
	LCD_WriteReg(0xE4, 0X01); //write_data(0x00,); //EQ
	LCD_WriteReg(0xE5, 0X10); //write_data(0x00,); //EQ
	LCD_WriteReg(0xE6, 0X01); //write_data(0x00,); //EQ
	LCD_WriteReg(0xE7, 0X10); //write_data(0x00,); //EQ
	LCD_WriteReg(0xE8, 0X70); //write_data(0x00,); //OPON
	LCD_WriteReg(0xF2, 0X00); //write_data(0x00,); //GEN
	LCD_WriteReg(0xEA, 0X00); //write_data(0x00,); //PTBA
	LCD_WriteReg(0xEB, 0X20); //write_data(0x00,); //PTBA
	LCD_WriteReg(0xEC, 0X3C); //write_data(0x00,); //STBA
	LCD_WriteReg(0xED, 0XC8); //write_data(0x00,); //STBA
	LCD_WriteReg(0xE9, 0X38); //write_data(0x00,); //OPON1
	LCD_WriteReg(0xF1, 0X01); //write_data(0x00,); //OTPS1B
	// Gamma 2.8 setting 
	LCD_WriteReg(0x40, 0X00); //write_data(0x00,); //
	LCD_WriteReg(0x41, 0X00); //write_data(0x00,); //
	LCD_WriteReg(0x42, 0X00); //write_data(0x00,); //
	LCD_WriteReg(0x43, 0X15); //write_data(0x00,); //
	LCD_WriteReg(0x44, 0X13); //write_data(0x00,); //
	LCD_WriteReg(0x45, 0X3f); //write_data(0x00,); //
	LCD_WriteReg(0x47, 0X55); //write_data(0x00,); //
	LCD_WriteReg(0x48, 0X00); //write_data(0x00,); //
	LCD_WriteReg(0x49, 0X12); //write_data(0x00,); //
	LCD_WriteReg(0x4A, 0X19); //write_data(0x00,); //
	LCD_WriteReg(0x4B, 0X19); //write_data(0x00,); //
	LCD_WriteReg(0x4C, 0X16); //write_data(0x00,); //
	LCD_WriteReg(0x50, 0X00); //write_data(0x00,); //
	LCD_WriteReg(0x51, 0X2c); //write_data(0x00,); //
	LCD_WriteReg(0x52, 0X2a); //write_data(0x00,); //
	LCD_WriteReg(0x53, 0X3F); //write_data(0x00,); //
	LCD_WriteReg(0x54, 0X3F); //write_data(0x00,); //
	LCD_WriteReg(0x55, 0X3F); //write_data(0x00,); //
	LCD_WriteReg(0x56, 0X2a); //write_data(0x00,); //
	LCD_WriteReg(0x57, 0X7e); //write_data(0x00,); //
	LCD_WriteReg(0x58, 0X09); //write_data(0x00,); //
	LCD_WriteReg(0x59, 0X06); //write_data(0x00,); //
	LCD_WriteReg(0x5A, 0X06); //write_data(0x00,); //
	LCD_WriteReg(0x5B, 0X0d); //write_data(0x00,); //
	LCD_WriteReg(0x5C, 0X1F); //write_data(0x00,); //
	LCD_WriteReg(0x5D, 0XFF); //write_data(0x00,); //
	// Power Voltage Setting
	LCD_WriteReg(0x1B, 0X1A); //write_data(0x00);
	LCD_WriteReg(0x1A, 0X02); //write_data(0x00);
	LCD_WriteReg(0x24, 0X61); //write_data(0x00);
	LCD_WriteReg(0x25, 0X5C); //write_data(0x00);
	// Vcom offset
	// LCD_WriteReg(0x23,0x8D); // FLICKER ADJUST
	LCD_WriteReg(0x23, 0x62); //write_data(0x00,0X62);
	// Power ON Setting
	LCD_WriteReg(0x18, 0X36); //write_data(0x00); //RADJ 70Hz
	LCD_WriteReg(0x19, 0X01); //write_data(0x00,0X01); //OSC_EN=1
	LCD_WriteReg(0x1F, 0X88); //write_data(0x00,0X88); // GAS=1, VOMG=00, PON=0, DK=1, XDK=0, DVDH_TRI=0, STB=0
	delay_ms(5);
	LCD_WriteReg(0x1F, 0X80); //write_data(0x00,0X80); // GAS=1, VOMG=00, PON=0, DK=0, XDK=0, DVDH_TRI=0, STB=0
	delay_ms(5);
	LCD_WriteReg(0x1F, 0X90); //write_data(0x00,0X90); // GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0
	delay_ms(5);
	LCD_WriteReg(0x1F, 0XD4); //write_data(0x00,0XD4); // GAS=1, VOMG=10, PON=1, DK=0, XDK=1, DDVDH_TRI=0, STB=0
	delay_ms(5);
	//262k/65k color selection
	LCD_WriteReg(0x17, 0X05); //write_data(0x00,0X05); //default 0x06 262k color // 0x05 65k color
	//SET PANEL
	LCD_WriteReg(0x36, 0X09); //write_data(0x00,0X09); //SS_P, GS_P,REV_P,BGR_P
	//Display ON Setting
	LCD_WriteReg(0x28, 0X38); //write_data(0x00,0X38); //GON=1, DTE=1, D=1000
	delay_ms(40);
	LCD_WriteReg(0x28, 0X3C); //write_data(0x00,0X3C); //GON=1, DTE=1, D=1100
}

