📄 hx8347d_cmo2.6_init.txt
字号:
void HX8347D_CMO2.6_Init(void)
{
//RESET
M51_WR_REG(U05_LCD_RST, 0x01); // LCD HW RST Enable
DelayX1ms(5);
M51_WR_REG(U05_LCD_RST, 0x00); // LCD HW RST Disable.
DelayX1ms(10);
//Driving ability Setting
Set_LCD_8B_REG(0xEA,0x00); //PTBA[15:8]
Set_LCD_8B_REG(0xEB,0x20); //PTBA[7:0]
Set_LCD_8B_REG(0xEC,0x0C); //STBA[15:8]
Set_LCD_8B_REG(0xED,0xC4); //STBA[7:0]
Set_LCD_8B_REG(0xE8,0x40); //OPON[7:0]
Set_LCD_8B_REG(0xE9,0x38); //OPON1[7:0]
Set_LCD_8B_REG(0xF1,0x01); //OTPS1B
Set_LCD_8B_REG(0xF2,0x10); //GEN
Set_LCD_8B_REG(0x27,0xA3); //
//Gamma 2.2 Setting
Set_LCD_8B_REG(0x40,0x01); //
Set_LCD_8B_REG(0x41,0x00); //
Set_LCD_8B_REG(0x42,0x00); //
Set_LCD_8B_REG(0x43,0x10); //
Set_LCD_8B_REG(0x44,0x0E); //
Set_LCD_8B_REG(0x45,0x24); //
Set_LCD_8B_REG(0x46,0x04); //
Set_LCD_8B_REG(0x47,0x50); //
Set_LCD_8B_REG(0x48,0x02); //
Set_LCD_8B_REG(0x49,0x13); //
Set_LCD_8B_REG(0x4A,0x19); //
Set_LCD_8B_REG(0x4B,0x19); //
Set_LCD_8B_REG(0x4C,0x16); //
Set_LCD_8B_REG(0x50,0x1B); //
Set_LCD_8B_REG(0x51,0x31); //
Set_LCD_8B_REG(0x52,0x2F); //
Set_LCD_8B_REG(0x53,0x3F); //
Set_LCD_8B_REG(0x54,0x3F); //
Set_LCD_8B_REG(0x55,0x3E); //
Set_LCD_8B_REG(0x56,0x2F); //
Set_LCD_8B_REG(0x57,0x7B); //
Set_LCD_8B_REG(0x58,0x09); //
Set_LCD_8B_REG(0x59,0x06); //
Set_LCD_8B_REG(0x5A,0x06); //
Set_LCD_8B_REG(0x5B,0x0C); //
Set_LCD_8B_REG(0x5C,0x1D); //
Set_LCD_8B_REG(0x5D,0xCC); //
//Power Voltage Setting
Set_LCD_8B_REG(0x1B,0x1B); //VRH=4.65V
Set_LCD_8B_REG(0x1A,0x01); //BT (VGH~15V,VGL~-10V,DDVDH~5V)
Set_LCD_8B_REG(0x24,0x2F); //VMH(VCOM High voltage ~3.2V)
Set_LCD_8B_REG(0x25,0x57); //VML(VCOM Low voltage -1.2V)
//****VCOM offset**///
Set_LCD_8B_REG(0x23,0x88); //for Flicker adjust //can reload from OTP
//Power on Setting
Set_LCD_8B_REG(0x18,0x36); //I/P_RADJ,N/P_RADJ, Normal mode 75Hz
Set_LCD_8B_REG(0x19,0x01); //OSC_EN='1', start Osc
Set_LCD_8B_REG(0x01,0x00); //DP_STB='0', out deep sleep
Set_LCD_8B_REG(0x1F,0x88);// GAS=1, VOMG=00, PON=0, DK=1, XDK=0, DVDH_TRI=0, STB=0
DelayX1ms(5);
Set_LCD_8B_REG(0x1F,0x80);// GAS=1, VOMG=00, PON=0, DK=0, XDK=0, DVDH_TRI=0, STB=0
DelayX1ms(5);
Set_LCD_8B_REG(0x1F,0x90);// GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0
DelayX1ms(5);
Set_LCD_8B_REG(0x1F,0xD0);// GAS=1, VOMG=10, PON=1, DK=0, XDK=0, DDVDH_TRI=0, STB=0
DelayX1ms(5);
//262k/65k color selection
Set_LCD_8B_REG(0x17,0x06); //default 0x06 262k color // 0x05 65k color
//SET PANEL
Set_LCD_8B_REG(0x36,0x00); //SS_P, GS_P,REV_P,BGR_P
//Display ON Setting
Set_LCD_8B_REG(0x28,0x38); //GON=1, DTE=1, D=1000
DelayX1ms(40);
Set_LCD_8B_REG(0x28,0x3C); //GON=1, DTE=1, D=1100
//Set GRAM Area
Set_LCD_8B_REG(0x02,0x00);
Set_LCD_8B_REG(0x03,0x00); //Column Start
Set_LCD_8B_REG(0x04,0x00);
Set_LCD_8B_REG(0x05,0xEF); //Column End
Set_LCD_8B_REG(0x06,0x00);
Set_LCD_8B_REG(0x07,0x00); //Row Start
Set_LCD_8B_REG(0x08,0x01);
Set_LCD_8B_REG(0x09,0x3F); //Row End
WR_8B_FORMAT(0x22); //Start GRAM write
}
//##################################################################
void LCD_Power_off(void)
{
// Power Off Setting
Set_LCD_8B_REG(0x28,0x38); //GON=’1’ DTE=’1’ D[1:0]=’10’
DelayX1ms(40);
Set_LCD_8B_REG(0x1F,0x89); // GAS=1, VOMG=00, PON=0, DK=1, XDK=0, DVDH_TRI=0, STB=1
DelayX1ms(40);
Set_LCD_8B_REG(0x28,0x04); //GON=’0’ DTE=’0’ D[1:0]=’01’
DelayX1ms(40);
Set_LCD_8B_REG(0x19,0x00); //OSC_EN=’0’
DelayX1ms(5);
M51_WR_REG(U05_LCD_POWER_ON, 0x00); //VCI & IOVCC OFF
}
//##################################################################
void ENTER_IDLE(void)
{
// ENTER IDLE mode Setting
Set_LCD_8B_REG(0x18,0x34); //I/P_RADJ,N/P_RADJ, IDLE mode 55Hz
Set_LCD_8B_REG(0x2F,0x11); //IDLE mode line inversion
Set_LCD_8B_REG(0x01,0x04); //IDLE='1' , enter IDLE mode
}
void EXIT_IDLE(void)
{
// EXIT IDLE mode Setting
Set_LCD_8B_REG(0x18,0x36); //I/P_RADJ,N/P_RADJ, Normal mode 75Hz
Set_LCD_8B_REG(0x2F,0x11); //Normal mode line inversion
Set_LCD_8B_REG(0x01,0x00); //IDLE='0', EXIT IDLE mode
}
//##################################################################
// ENTER Partial mode Setting 32line
Set_LCD_8B_REG(0x18,0x36); //I/P_RADJ,N/P_RADJ Partial mode 75Hz
Set_LCD_8B_REG(0x2F,0x11); //Partial mode line inversion
Set_LCD_8B_REG(0x01,0x01); //PTL='1', Enter Partial mode
Set_LCD_8B_REG(0x0A,0x00); //PSL[15:8]=0x00
Set_LCD_8B_REG(0x0B,0x20); //PSL[7:0]=0x20
Set_LCD_8B_REG(0x0C,0x00); //PEL[15:8]=0x00
Set_LCD_8B_REG(0x0D,0x47); //PEL[7:0]=0x47
Set_LCD_8B_REG(0x26,0x01); //refresh cycle=5frame
// EXIT Partial mode Setting
Set_LCD_8B_REG(0x18,0x36); //I/P_RADJ,N/P_RADJ, Normal mode 75Hz
Set_LCD_8B_REG(0x2F,0x11); //Normal mode, line inversion
Set_LCD_8B_REG(0x01,0x00); //PTL='0', EXIT Partial mode
//##################################################################
// ENTER Partial + IDLE mode Setting 32line
Set_LCD_8B_REG(0x18,0x34); //I/P_RADJ,N/P_RADJ, Partial mode 55Hz
Set_LCD_8B_REG(0x2F,0x11); // Partial + IDLE mode line inversion
Set_LCD_8B_REG(0x01,0x09); // PTL='1' IDLE=’1’, Enter Partial + IDLE mode
Set_LCD_8B_REG(0x0A,0x00); //PSL[15:8]=0x00
Set_LCD_8B_REG(0x0B,0x20); //PSL[7:0]=0x20
Set_LCD_8B_REG(0x0C,0x00); //PEL[15:8]=0x00
Set_LCD_8B_REG(0x0D,0x47); //PEL[7:0]=0x47
Set_LCD_8B_REG(0x26,0x01); //refresh cycle=5frame
// EXIT Partial + IDLE mode Setting
Set_LCD_8B_REG(0x18,0x36); //I/P_RADJ,N/P_RADJ ,Normal mode 75Hz
Set_LCD_8B_REG(0x2F,0x11); //Normal mode, line inversion
Set_LCD_8B_REG(0x01,0x00); // PTL='0' IDLE=’0’, EXIT Partial + IDLE mode
//##################################################################
// Enter Sleep mode Setting
Set_LCD_8B_REG(0x28,0x38); //GON=’1’ DTE=’1’ D[1:0]=’10’
DelayX1ms(40);
Set_LCD_8B_REG(0x1F,0x89); // GAS=1, VOMG=00, PON=0, DK=1, XDK=0, DVDH_TRI=0, STB=1
DelayX1ms(40);
Set_LCD_8B_REG(0x28,0x04); //GON=’0’ DTE=’0’ D[1:0]=’01’
DelayX1ms(40);
Set_LCD_8B_REG(0x19,0x00); //OSC_EN=’0’
DelayX1ms(5);
// Exit Sleep mode Setting
Set_LCD_8B_REG(0x18,0x36); //I/P_RADJ,N/P_RADJ, Normal mode 75Hz
Set_LCD_8B_REG(0x19,0x01); //OSC_EN='1', start Osc
Set_LCD_8B_REG(0x1F,0x88);// GAS=1, VOMG=00, PON=0, DK=1, XDK=0, DVDH_TRI=0, STB=0
DelayX1ms(5);
Set_LCD_8B_REG(0x1F,0x80);// GAS=1, VOMG=00, PON=0, DK=0, XDK=0, DVDH_TRI=0, STB=0
DelayX1ms(5);
Set_LCD_8B_REG(0x1F,0x90);// GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0
DelayX1ms(5);
Set_LCD_8B_REG(0x1F,0xD0);// GAS=1, VOMG=10, PON=1, DK=0, XDK=0, DDVDH_TRI=0, STB=0
DelayX1ms(5);
Set_LCD_8B_REG(0x28,0x38); //GON=1, DTE=1, D=1000
DelayX1ms(40);
Set_LCD_8B_REG(0x28,0x3F); //GON=1, DTE=1, D=1100
//##################################################################
// Enter Deep Sleep mode Setting
Set_LCD_8B_REG(0x28,0x38); //GON=’1’ DTE=’1’ D[1:0]=’10’
DelayX1ms(40);
Set_LCD_8B_REG(0x1F,0x89); // GAS=1, VOMG=00, PON=0, DK=1, XDK=0, DVDH_TRI=0, STB=1
DelayX1ms(40);
Set_LCD_8B_REG(0x28,0x04); //GON=’0’ DTE=’0’ D[1:0]=’01’
DelayX1ms(40);
Set_LCD_8B_REG(0x19,0x00); //OSC_EN=’0’
DelayX1ms(5);
Set_LCD_8B_REG(0x01,0xC0); //DP_STB[1:0]=’11’
// Exit Deep Sleep mode Setting
Set_LCD_8B_REG(0x01,0x00); //DP_STB='0', out deep sleep
DelayX1ms(10);
Set_LCD_8B_REG(0x19,0x01); //OSC_EN='1', start Osc
Set_LCD_8B_REG(0x1F,0x88);// GAS=1, VOMG=00, PON=0, DK=1, XDK=0, DVDH_TRI=0, STB=0
DelayX1ms(5);
Set_LCD_8B_REG(0x1F,0x80);// GAS=1, VOMG=00, PON=0, DK=0, XDK=0, DVDH_TRI=0, STB=0
DelayX1ms(5);
Set_LCD_8B_REG(0x1F,0x90);// GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0
DelayX1ms(5);
Set_LCD_8B_REG(0x1F,0xD0);// GAS=1, VOMG=10, PON=1, DK=0, XDK=0, DDVDH_TRI=0, STB=0
DelayX1ms(5);
Set_LCD_8B_REG(0x28,0x38); //GON=1, DTE=1, D=1000
DelayX1ms(40);
Set_LCD_8B_REG(0x28,0x3F); //GON=1, DTE=1, D=1100
WR_8B_FORMAT(0x22); //Start GRAM write
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -