⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 8345 .cpp

📁 TFT液晶LCD的控制器HX8345的驱动程序
💻 CPP
字号:
void initial_lcd()
{
     Reset();
     //Write_command(0x0001, 0x0010);
     Write_command(0x0000, 0x0001);
     Write_command(0x0001, 0x0013);  //0013
     Write_command(0x0002, 0x0700); //0700
     Write_command(0x0005, 0x0030); //0030
     Write_command(0x0006, 0x0000);
     Write_command(0x0008, 0x0202);
     Write_command(0x000a, 0x0000);
     Write_command(0x000b, 0x1800);   //1800  0d00
     Write_command(0x000f, 0x0000);  //000f
     Write_command(0x0010, 0x0000);
     Write_command(0x0011, 0x0000);
     Write_command(0x0014, 0x9f00);
     Write_command(0x0015, 0x9f00);
     Write_command(0x0016, 0x7f00);
     Write_command(0x0017, 0x9f00);
     Write_command(0x0020, 0x0000);
     Write_command(0x0021, 0x0000);
     Write_command(0x0023, 0x0000);
     Write_command(0x0024, 0x0000);
     Write_command(0x0025, 0x0000);
     Write_command(0x0026, 0x0000);
     Delay1ms(50);

     Write_command(0x0030, 0x0000);
     Write_command(0x0031, 0x0407);
     Write_command(0x0032, 0x0004);
     Write_command(0x0033, 0x0402);
     Write_command(0x0034, 0x0307);
     Write_command(0x0035, 0x0003);
     Write_command(0x0036, 0x0707);
     Write_command(0x0037, 0x0304);
     Write_command(0x003a, 0x0000);
     Write_command(0x003b, 0x0d00);  //frame f 0e00

     Write_command(0x000d, 0x0000);
     Delay1ms(50);
     Write_command(0x000e, 0x0000);
     Delay1ms(50);
     Write_command(0x0007, 0x0000);
     Delay1ms(50);
     Write_command(0x000c, 0x0000);
     Delay1ms(50);
     Write_command(0x0009, 0x0008);
     Delay1ms(50);
     Write_command(0x000d, 0x0003);
     Delay1ms(50);
     Write_command(0x000e, 0x1017);
     Delay1ms(50);
     Write_command(0x000d, 0x0011);
     Delay1ms(50);
     Write_command(0x0003, 0x0010);
     Delay1ms(50);
     Write_command(0x0009, 0x0000);
     Delay1ms(50);
     Write_command(0x0003, 0x0208); //0410
     Delay1ms(50);
     Write_command(0x000e, 0x341b);//3317 341b 391e
     Delay1ms(50);
     Write_command(0x0009, 0x0002);
     Delay1ms(50);
     Write_command(0x0007, 0x0005);
     Delay1ms(50);
     Write_command(0x0007, 0x0025);
     Delay1ms(50);
     Write_command(0x0007, 0x0027);
     Delay1ms(50);
     Write_command(0x0007, 0x0037);
     Delay1ms(50);


     Write_index(0x0022);
     Delay1ms(100);

}
//*********************

void LCD_HX8345A_INTO_STB (void)
{
Write_command(0x000B, 0x0000); //R0Bh=0000h, NO1-0=0h, SDT1-0=0h,EQ1-0=0h, DIV1-0=0h, RTN3-0=0h,/
//############### Display Off ##################//
Write_command(0x0007, 0x0036); //R07h=0036h,PT1-0=0h,VLE2-1=0h,SPT=0h, GON=1h, DTE=1h,CL=0h, REV=1h, D1-0=2h.
Delay1ms (40);
Write_command(0x0007, 0x0026); //R07h=0026h,PT1-0=0h,VLE2-1=0h,SPT=0h, GON=1h, DTE=0h,CL=0h, REV=1h, D1~0=2h.
Delay1ms (40);
Write_command(0x0007, 0x0004); //R07h=0004h, PT1-0=0h, VLE2-1=0h,SPT=0h, GON=0h, DTE=0h, CL=0h,REV=1h, D1~0=0h.
//############### Power Off ##################//
Write_command(0x0009, 0x0008); //R09h=0000h, DCM1-0=0h, DC12-1=0h,DK=1h, SAP2-0=0h.
Write_command(0x0003, 0x0000); //R03h=0000h, BT2-0=0h, DC02-1=0h,AP2-0=0h, SLP=0h, STB=0h.
Write_command(0x000D, 0x0000); //R0Dh=0000h, PON=0h, VRH3-0=0h,
Write_command(0x000E, 0x0000); //R0Eh=0000h, VCOMG=0h, DVD4-0=00h,VCM4-0=00h./
//############### Into Standby mode ##############//
Write_command(0x0003, 0x0001); //R03h=0000h, BT2-0=0h, DC02-1=0h,AP2-0=0h, SLP=0h, STB=1h.
}

void LCD_HX8345A_EXIT_STB(void)
{
//Start Oscillation
Write_command(0x0000, 0x0001);
Delay1ms (10);
// Exit STB mode
Write_command(0x0003, 0x0000); //R03h=0000h, BT2-0=000, DC02-1=00,
Write_command(0x000D, 0x0000);
Delay1ms(50);
Write_command(0x000E, 0x0000);
Delay1ms(50);
Write_command(0x0007, 0x0000);
Delay1ms(50);
Write_command(0x000C, 0x0000);
Write_command(0x0009, 0x0008);
Delay1ms(50);
Write_command(0x000D, 0x0003);
Delay1ms(50);
Write_command(0x000E, 0x1017);
Delay1ms(50);
Write_command(0x000D, 0x0011);
Delay1ms(50);
Write_command(0x0003, 0x0010);
Delay1ms (50);
Write_command(0x0009, 0x0000);
Delay1ms(50);
Write_command(0x0003, 0x0208);
Delay1ms(50);
Write_command(0x000E, 0x341b);
Delay1ms (150);
Write_command(0x0009, 0x0002);
Delay1ms(50);
Write_command(0x0007, 0x0005);
Delay1ms(50); //Stable
Write_command(0x0007, 0x0025);
Write_command(0x0007, 0x0027);
Delay1ms(50); //Stable
Write_command(0x0007, 0x0037);
Delay1ms(50); //Stable
Write_index(0x0022);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -