//*************************************************************** // //***** Focus LCDs ***** //***** LCDs Made Simple ***** //***** www.FocusLCDs.com ***** // //*************************************************************** // // //**************************// NOTE:VCI=3.3V,IOVCC=1.8V-3.3V, Display resolution:480*854 params->vertical_sync_active=4 params->vertical_backporch=20 params->vertical_frontporch=10 params->horizontal_sync_active=4 params->horizontal_backporch=40 params->horizontal_frontporch=20 params->RGB.PLL_CLOCK=(29) //**************************************************************** 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; } //--------------------initial code-----------------------------------------// void LCD_Init(void) { RST=1; delay(1) //MS RST=0; delay(10);//MS RST=1; delay(120)//MS //*******************************/ write_command(0x11); //OUT SLEEP delay(120); write_command(0xFF); write_data(0x77); write_data(0x01); write_data(0x00); write_data(0x00); write_data(0x13); write_command(0xEF); write_data(0x08); /*-------------------------------Bank0 Setting--------------------------------*/ /*--------------------------Display Control setting---------------------------*/ write_command(0xFF); write_data(0x77); write_data(0x01); write_data(0x00); write_data(0x00); write_data(0x10); write_command(0xC0); //480*854 write_data(0xE9); write_data(0x03); write_command(0xC1); write_data(0x10); write_data(0x0C); write_command(0xC2);//Inversion selection write_data(0x31);//31 2-DOT 37-Column write_data(0x0A); write_command(0xCC); write_data(0x10); //**********GAMMA SET***************// write_command(0xB0); write_data(0x0D); write_data(0x14); write_data(0x9C); write_data(0x0B); write_data(0x10); write_data(0x06); write_data(0x08); write_data(0x09); write_data(0x08); write_data(0x22); write_data(0x02); write_data(0x4F); write_data(0x0E); write_data(0x66); write_data(0x2D); write_data(0x1F); write_command(0xB1); write_data(0x00); write_data(0x17); write_data(0x9E); write_data(0x0F); write_data(0x11); write_data(0x06); write_data(0x0C); write_data(0x08); write_data(0x08); write_data(0x26); write_data(0x04); write_data(0x51); write_data(0x10); write_data(0x6A); write_data(0x33); write_data(0x1B); /*-----------------------------End Gamma Setting------------------------------*/ /*------------------------End Display Control setting-------------------------*/ /*-----------------------------Bank0 Setting End-----------------------------*/ /*-------------------------------Bank1 Setting--------------------------------*/ /*--------------------- Power Control Registers Initial ----------------------*/ write_command(0xFF); write_data(0x77); write_data(0x01); write_data(0x00); write_data(0x00); write_data(0x11); write_command(0xB0); write_data(0x30); /*--------------------------------Vcom Setting--------------------------------*/ write_command(0xB1); write_data(0x5C); /*------------------------------End Vcom Setting------------------------------*/ write_command(0xB2);//VGH write_data(0x81); //+12V write_command(0xB3); write_data(0x80); write_command(0xB5);//VGL write_data(0x43);//-8V 4E write_command(0xB7); write_data(0x85); write_command(0xB8); //avdd write_data(0x20); write_command(0xC1); write_data(0x78); write_command(0xC2); write_data(0x78); write_command(0xD0); write_data(0x88); /*--------------------End Power Control Registers Initial --------------------*/ //********GIP SET********************/// write_command(0xE0); write_data(0x00); write_data(0x00); write_data(0x02); write_command(0xE1); write_data(0x06); write_data(0xA0); write_data(0x08); write_data(0xA0); write_data(0x05); write_data(0xA0); write_data(0x07); write_data(0xA0); write_data(0x00); write_data(0x44); write_data(0x44); write_command(0xE2); write_data(0x30); write_data(0x30); write_data(0x44); write_data(0x44); write_data(0x6E); write_data(0xA0); write_data(0x00); write_data(0x00); write_data(0x6E); write_data(0xA0); write_data(0x00); write_data(0x00); write_command(0xE3); write_data(0x00); write_data(0x00); write_data(0x33); write_data(0x33); write_command(0xE4); write_data(0x44); write_data(0x44); write_command(0xE5); write_data(0x0D); write_data(0x69); write_data(0x0A); write_data(0xA0); write_data(0x0F); write_data(0x6B); write_data(0x0A); write_data(0xA0); write_data(0x09); write_data(0x65); write_data(0x0A); write_data(0xA0); write_data(0x0B); write_data(0x67); write_data(0x0A); write_data(0xA0); write_command(0xE6); write_data(0x00); write_data(0x00); write_data(0x33); write_data(0x33); write_command(0xE7); write_data(0x44); write_data(0x44); write_command(0xE8); write_data(0x0C); write_data(0x68); write_data(0x0A); write_data(0xA0); write_data(0x0E); write_data(0x6A); write_data(0x0A); write_data(0xA0); write_data(0x08); write_data(0x64); write_data(0x0A); write_data(0xA0); write_data(0x0A); write_data(0x66); write_data(0x0A); write_data(0xA0); write_command(0xE9); write_data(0x36); write_data(0x00); write_command(0xEB); write_data(0x00); write_data(0x01); write_data(0xE4); write_data(0xE4); write_data(0x44); write_data(0x88); write_data(0x40); write_command(0xED); write_data(0xFF); write_data(0x45); write_data(0x67); write_data(0xFA); write_data(0x01); write_data(0x2B); write_data(0xCF); write_data(0xFF); write_data(0xFF); write_data(0xFC); write_data(0xB2); write_data(0x10); write_data(0xAF); write_data(0x76); write_data(0x54); write_data(0xFF); write_command(0xEF); write_data(0x10); write_data(0x0D); write_data(0x04); write_data(0x08); write_data(0x3F); write_data(0x1F); write_command(0xFF); write_data(0x77); write_data(0x01); write_data(0x00); write_data(0x00); write_data(0x00); write_command(0x35);//TE ON write_data(0x00); write_command(0x36); write_data(0x00);//10-180 write_command(0x3A); write_data(0x50); write_command(0x29); //DISP ON delay(25); } //******************************************* void EnterSleep (void) { write_command(0x28); delay(10); write_command(0x10); } //********************************************************* void ExitSleep (void) { write_command(0x11); delay(120); write_command(0x29); }