ILI9341_initialize初始化程序
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
void initial_ILI9341()
{
// VCI=2.8V
//************* Reset LCD Driver ****************//
RES = 1;
delayms(1); // Delay 1ms
RES = 0;
delayms(10); // Delay 10ms // This delay time is necessary
RES = 1;
delayms(120); // Delay 1200 ms
//************* Start Initial Sequence **********//
WriteCOM(0xCF);
WriteCOM_DATA(0x00);
WriteCOM_DATA(0xC1);
WriteCOM_DATA(0X30);
WriteCOM(0xED);
WriteCOM_DATA(0x64);
WriteCOM_DATA(0x03);
WriteCOM_DATA(0X12);
WriteCOM_DATA(0X81);
WriteCOM(0xE8);
WriteCOM_DATA(0x85);
WriteCOM_DATA(0x00);
WriteCOM_DATA(0x78);
WriteCOM(0xCB);
WriteCOM_DATA(0x39);
WriteCOM_DATA(0x2C);
WriteCOM_DATA(0x00);
WriteCOM_DATA(0x34);
WriteCOM_DATA(0x02);
WriteCOM(0xF7);
WriteCOM_DATA(0x20);
WriteCOM(0xEA);
WriteCOM_DATA(0x00);
WriteCOM_DATA(0x00);
WriteCOM(0xC0); //Power control
WriteCOM_DATA(0x18); //VRH[5:0]
WriteCOM(0xC1); //Power control
WriteCOM_DATA(0x12); //SAP[2:0];BT[3:0]
WriteCOM(0xC5); //VCM control
WriteCOM_DATA(0x31);
WriteCOM_DATA(0x3C);
WriteCOM(0xC7); //VCM control2
WriteCOM_DATA(0X99);
WriteCOM(0x36); // Memory Access Control
WriteCOM_DATA(0x08);
WriteCOM(0x3A);
WriteCOM_DATA(0x55);
WriteCOM(0xB1);
WriteCOM_DATA(0x00);
WriteCOM_DATA(0x16);
WriteCOM(0xB6); // Display Function Control
WriteCOM_DATA(0x0A);
WriteCOM_DATA(0xA2);
WriteCOM(0xF6);
WriteCOM_DATA(0x01);
WriteCOM_DATA(0x30);
WriteCOM(0xF2); // 3Gamma Function Disable
WriteCOM_DATA(0x00);
WriteCOM(0x26); //Gamma curve selected
WriteCOM_DATA(0x02);
WriteCOM(0xE0); //Set Gamma
WriteCOM_DATA(0x0F);
WriteCOM_DATA(0x1D);
WriteCOM_DATA(0x1A);
WriteCOM_DATA(0x0A);
WriteCOM_DATA(0x0D);
WriteCOM_DATA(0x07);
WriteCOM_DATA(0x49);
WriteCOM_DATA(0X66);
WriteCOM_DATA(0x3B);
WriteCOM_DATA(0x07);
WriteCOM_DATA(0x11);
WriteCOM_DATA(0x01);
WriteCOM_DATA(0x09);
WriteCOM_DATA(0x05);
WriteCOM_DATA(0x04);
WriteCOM(0XE1); //Set Gamma
WriteCOM_DATA(0x00);
WriteCOM_DATA(0x18);
WriteCOM_DATA(0x1D);
WriteCOM_DATA(0x02);
WriteCOM_DATA(0x0F);
WriteCOM_DATA(0x04);
WriteCOM_DATA(0x36);
WriteCOM_DATA(0x13);
WriteCOM_DATA(0x4C);
WriteCOM_DATA(0x07);
WriteCOM_DATA(0x13);
WriteCOM_DATA(0x0F);
WriteCOM_DATA(0x2E);
WriteCOM_DATA(0x2F);
WriteCOM_DATA(0x05);
WriteCOM(0x11); //Exit Sleep
delayms(120);
WriteCOM(0x29); //Display on
}
/************************************初始化结束**********************************/