📄 hx8347.c
字号:
//////////2.8////////////////
void INITIAL_HX8347(void)
{
//##########################################################################
//Gamma Set:
Set_LCD_8B_REG(0x46,0x95); //
Set_LCD_8B_REG(0x47,0x51); //
Set_LCD_8B_REG(0x48,0x00); //
Set_LCD_8B_REG(0x49,0x36); //
Set_LCD_8B_REG(0x4A,0x11); //
Set_LCD_8B_REG(0x4B,0x66); //
Set_LCD_8B_REG(0x4C,0x14); //
Set_LCD_8B_REG(0x4D,0x77); //
Set_LCD_8B_REG(0x4E,0x13); //
Set_LCD_8B_REG(0x4F,0x4C); //
Set_LCD_8B_REG(0x50,0x46); //
Set_LCD_8B_REG(0x51,0x46); //
//##########################################################################
//240x320 window setting:
Set_LCD_8B_REG(0x02,0x00); // Column address start2
Set_LCD_8B_REG(0x03,0x00); // Column address start1
Set_LCD_8B_REG(0x04,0x00); // Column address end2
Set_LCD_8B_REG(0x05,0xEF); // Column address end1
Set_LCD_8B_REG(0x06,0x00); // Row address start2
Set_LCD_8B_REG(0x07,0x00); // Row address start1
Set_LCD_8B_REG(0x08,0x01); // Row address end2
Set_LCD_8B_REG(0x09,0x3F); // Row address end1
Set_LCD_8B_REG(0x90,0x7F); // SAP=0111 1111
//##########################################################################
// Display Setting:
Set_LCD_8B_REG(0x01,0x06); // IDMON=0, INVON=1, NORON=1, PTLON=0
Set_LCD_8B_REG(0x16,0xC8); //MY, MX, MV, ML, BGR, TEON
Set_LCD_8B_REG(0x23,0x95); // N_DC=1001 0101
Set_LCD_8B_REG(0x24,0x95); // P_DC=1001 0101
Set_LCD_8B_REG(0x25,0xFF); // I_DC=1111 1111
Set_LCD_8B_REG(0x27,0x06); // N_BP=0000 0110
Set_LCD_8B_REG(0x28,0x06); // N_FP=0000 0110
Set_LCD_8B_REG(0x29,0x06); // P_BP=0000 0110
Set_LCD_8B_REG(0x2A,0x06); // P_FP=0000 0110
Set_LCD_8B_REG(0x2C,0x06); // I_BP=0000 0110
Set_LCD_8B_REG(0x2D,0x06); // I_FP=0000 0110
Set_LCD_8B_REG(0x3A,0x01); // N_RTN=0000, N_NW=001
Set_LCD_8B_REG(0x3B,0x01); // P_RTN=0000, P_NW=001
Set_LCD_8B_REG(0x3C,0xF0); // I_RTN=1111, I_NW=000
Set_LCD_8B_REG(0x3D,0x00); // DIV=00
DelayX1ms(20);
Set_LCD_8B_REG(0x10,0xA6); // SS=0,GS=0 CSEL=110
//##########################################################################
// Power Supply Setting
Set_LCD_8B_REG(0x19,0x49); // OSCADJ=10 0000, OSD_EN=1 //60Hz
Set_LCD_8B_REG(0x93,0x0C); // RADJ=1100,
DelayX1ms(10);
Set_LCD_8B_REG(0x20,0x40); // BT=0100
Set_LCD_8B_REG(0x1D,0x07); // VC1=111
Set_LCD_8B_REG(0x1E,0x00); // VC3=000
Set_LCD_8B_REG(0x1F,0x04); // VRH=0100
Set_LCD_8B_REG(0x44,0x4D); // VCM=101 0000
Set_LCD_8B_REG(0x45,0x11); // VDV=1 0001
DelayX1ms(10);
Set_LCD_8B_REG(0x1C,0x04); // AP=100
DelayX1ms(20);
Set_LCD_8B_REG(0x43,0x80); //set VCOMG=1
DelayX1ms(5);
Set_LCD_8B_REG(0x1B,0x18); // GASENB=0, PON=1, DK=1, XDK=0, DDVDH_TRI=0, STB=0
DelayX1ms(40);
Set_LCD_8B_REG(0x1B,0x10); // GASENB=0, PON=1, DK=0, XDK=0, DDVDH_TRI=0, STB=0
DelayX1ms(40);
//##########################################################################
// Display ON Setting
Set_LCD_8B_REG(0x26,0x04); //GON=0, DTE=0, D=01
DelayX1ms(40);
Set_LCD_8B_REG(0x26,0x24); //GON=1, DTE=0, D=01
Set_LCD_8B_REG(0x26,0x2C); //GON=1, DTE=0, D=11
DelayX1ms(40);
Set_LCD_8B_REG(0x26,0x3C); //GON=1, DTE=1, D=11
Set_LCD_8B_REG(0x35,0x38); // EQS=38h
Set_LCD_8B_REG(0x36,0x78); // EQP=78h
Set_LCD_8B_REG(0x3E,0x38); // SON=38h
Set_LCD_8B_REG(0x40,0x0F); // GDON=0Fh
Set_LCD_8B_REG(0x41,0xF0); // GDOFF
//##########################################################################
//set spulse & rpulse
Set_LCD_8B_REG(0x57,0x02); // Test mode='1'
Set_LCD_8B_REG(0x56,0x84); // set Rpulse='1000',spulse='0100'
Set_LCD_8B_REG(0x57,0x00); // Test mode= '0'
//##########################################################################
}
void Set_LCD_8B_REG(uchar reg,uchar dat)
{
rd=1;
rs=0;
dataport=reg;
cs=0;
wr=0;
_nop_();
wr=1;
rs=1;
dataport=dat;
wr=0;
_nop_();
wr=1;
cs=1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -