//*************************************************************** // //***** Focus LCDs ***** //***** LCDs Made Simple ***** //***** www.FocusLCDs.com ***** // //*************************************************************** // ////NOTE:VCC=3.3V, VCI=3.3V,IOVCC=1.8-3.3V. Display resolution:480*800 params->dsi.vertical_sync_active=4 params->dsi.vertical_backporch=20 params->dsi.vertical_frontporch=10 params->dsi.horizontal_sync_active=4 params->dsi.horizontal_backporch=10 params->dsi.horizontal_frontporch=45 params->RGB_CLOCK=(27)MHZ Frame Rate=60HZ //**************************************************************** void write_command (unsigned char y) // (uchar y,uchar x) { unsigned char i; csb=0; sclb=0; sdi=0; sclb=1; for(i=0;i<8;i++) { sclb=0; if (y&0x80) { sdi=1; } else { sdi=0; } sclb=1; y=y<<1; } csb=1; } //*************************************************************** void write_data(unsigned char w) // (uchar w, uchar v) { unsigned char i; csb=0; sclb=0; sdi=1; sclb=1; for(i=0;i<8;i++) { sclb=0; if (w&0x80) { sdi=1; } else { sdi=0; } sclb=1; w=w<<1; } csb=1; } /*************************************************/ void initi(void) { res=1; delay(1); res=0; delay(10); res=1; delay(200); //***************************************************************//LCD SETING write_command(0xFF); // Change to Page 1 CMD write_data(0xff); write_data(0x98); write_data(0x06); write_data(0x04); write_data(0x01); write_command(0x08); //Output SDA write_data(0x00); //10 write_command(0x20);//set DE/VSYNC mode write_data(0x00); //01 VSYNC MODE write_command(0x21); //DE = 1 Active write_data(0x01);//01 //write_command(0x22);// //write_data(0x01); write_command(0x30);//Resolution setting 480 X 800 write_data(0x02); //02 write_command(0x31); //Inversion setting write_data(0x00); //02-2dot write_command(0x40); //BT DDVDH DDVDL write_data(0x00); //10,14,18 00 2XVCI write_command(0x41); write_data(0x44); //avdd +5.2v,avee-5.2v 33 write_command(0x42); write_data(0x00); //VGL=DDVDH+VCIP -DDVDL,VGH=2DDVDL-VCIP write_command(0x43); write_data(0x80); //SET VGH clamp level +15v write_command(0x44); write_data(0x86); //SET VGL clamp level -10v write_command(0x46); write_data(0x34); write_command(0x50);//VREG1 for positive Gamma write_data(0x94); //A8 write_command(0x51);//VREG2 for negative Gamma write_data(0x94); //A8 write_command(0x52);//VCOM write_data(0x00); write_command(0x53); //Forward Flicker write_data(0x67); //VCOM write_command(0x54); //VCOM write_data(0x00); write_command(0x55); //Backward Flicker write_data(0x67); //VCOM write_command(0x60); write_data(0x07); write_command(0x61); write_data(0x04); write_command(0x62); write_data(0x08); write_command(0x63); write_data(0x04); write_command(0xA0); //Positive Gamma write_data(0x00); write_command(0xA1); // write_data(0x0B); write_command(0xA2); // write_data(0x13); write_command(0xA3); // write_data(0x0C); write_command(0xA4); // write_data(0x05); write_command(0xA5); // write_data(0x0C); write_command(0xA6); // write_data(0x08); write_command(0xA7); // write_data(0x06); write_command(0xA8); // write_data(0x06); write_command(0xA9); // write_data(0x0A); write_command(0xAA); // write_data(0x0F); write_command(0xAB); // write_data(0x06); write_command(0xAC); // write_data(0x12); write_command(0xAD); // write_data(0x18); write_command(0xAE); // write_data(0x12); write_command(0xAF); // write_data(0x0B); write_command(0xC0); //Negative Gamma write_data(0x00); write_command(0xC1); // write_data(0x0B); write_command(0xC2); // write_data(0x13); write_command(0xC3); // write_data(0x0C); write_command(0xC4); // write_data(0x05); write_command(0xC5); // write_data(0x0C); write_command(0xC6); // write_data(0x08); write_command(0xC7); // write_data(0x06); write_command(0xC8); // write_data(0x06); write_command(0xC9); // write_data(0x0A); write_command(0xCA); // write_data(0x0F); write_command(0xCB); // write_data(0x06); write_command(0xCC); // write_data(0x12); write_command(0xCD); // write_data(0x18); write_command(0xCE); // write_data(0x12); write_command(0xCF); // write_data(0x0B); write_command(0xFF); // Change to Page 6 CMD for GIP timing write_data(0xFF); write_data(0x98); write_data(0x06); write_data(0x04); write_data(0x06); write_command(0x00); // write_data(0x21); write_command(0x01); // write_data(0x0A); write_command(0x02); // write_data(0x00); write_command(0x03); // write_data(0x00); write_command(0x04); // write_data(0x32); write_command(0x05); // write_data(0x32); write_command(0x06); // write_data(0x98); write_command(0x07); // write_data(0x06); write_command(0x08); // write_data(0x05); write_command(0x09); // write_data(0x00); write_command(0x0A); // write_data(0x00); write_command(0x0B); // write_data(0x00); write_command(0x0C); // write_data(0x32); write_command(0x0D); // write_data(0x32); write_command(0x0E); // write_data(0x01); write_command(0x0F); // write_data(0x01); write_command(0x10); // write_data(0xF0); write_command(0x11); // write_data(0xF0); write_command(0x12); // write_data(0x00); write_command(0x13); // write_data(0x00); write_command(0x14); // write_data(0x00); write_command(0x15); // write_data(0x43); write_command(0x16); // write_data(0x0B); write_command(0x17); // write_data(0x00); write_command(0x18); // write_data(0x00); write_command(0x19); // write_data(0x00); write_command(0x1A); // write_data(0x00); write_command(0x1B); // write_data(0x00); write_command(0x1C); // write_data(0x00); write_command(0x1D); // write_data(0x00); write_command(0x20); // write_data(0x01); write_command(0x21); // write_data(0x23); write_command(0x22); // write_data(0x45); write_command(0x23); // write_data(0x67); write_command(0x24); // write_data(0x01); write_command(0x25); // write_data(0x23); write_command(0x26); // write_data(0x45); write_command(0x27); // write_data(0x67); write_command(0x30); // write_data(0x01); write_command(0x31); // write_data(0x11); write_command(0x32); // write_data(0x00); write_command(0x33); // write_data(0x22); write_command(0x34); // write_data(0x22); write_command(0x35); // write_data(0xcb); write_command(0x36); // write_data(0xda); write_command(0x37); // write_data(0xAD); write_command(0x38); // write_data(0xbc); write_command(0x39); // write_data(0x66); write_command(0x3A); // write_data(0x77); write_command(0x3B); // write_data(0x22); write_command(0x3C); // write_data(0x22); write_command(0x3D); // write_data(0x22); write_command(0x3E); // write_data(0x22); write_command(0x3F); // write_data(0x22); write_command(0x40); // write_data(0x22); write_command(0x52); // write_data(0x10); write_command(0xFF); // Change to Page 7 CMD for GIP timing write_data(0xFF); write_data(0x98); write_data(0x06); write_data(0x04); write_data(0x07); write_command(0x18); // write_data(0x1d); write_command(0x02); // write_data(0x77); write_command(0xE1); // write_data(0x79); write_command(0xFF); // Change to Page 0 CMD for Normal command write_data(0xFF); write_data(0x98); write_data(0x06); write_data(0x04); write_data(0x00); write_command(0x36); write_data(0x01); write_command(0x3A); write_data(0x70); //24BIT write_command(0x11); delay(120); write_command(0x29); delay(25); } //******************************************* void EnterSleep (void) { write_command(0x28); delay(10); write_command(0x10); } //********************************************************* void ExitSleep (void) { write_command(0x11); delay(120); write_command(0x29); }