//*************************************************************** // //***** Focus LCDs ***** //***** LCDs Made Simple ***** //***** www.FocusLCDs.com ***** // //*************************************************************** // ////VCI=3.3V, //*********************16BIT********************************* void write_command(unsigned int i) { cs=0; rd=1; rs=0; P2=i>>8; P0=i; rw=0; rw=1; cs=1; } void write_data(unsigned int i) { cs=0; rd=1; rs=1; P2=i>>8; P0=i; rw=0;; rw=1; cs=1; } //********************8BIT**************************************** void write_command(unsigned int i) { cs=0; rd=1; rs=0; P2=i; rw=0; rw=1; cs=1; } void write_data(unsigned int i) { cs=0; rd=1; rs=1; P2=i>>8; P2=i; rw=0;; rw=1; cs=1; } /*************************************************/ void initi(void) { res=1; delay(1); res=0; delay(10); res=1; delay(120); //************************************************ write_command(0xC8); //Set EXTC write_data(0xFF); write_data(0x93); write_data(0x42); write_command(0xb6); write_data(0x0a); write_data(0xE0);//SS GS write_command(0x36); //Memory Access Control write_data(0x08); //MY,MX,MV,ML,BGR,MH write_command(0x3A); //Pixel Format Set write_data(0x55); //DPI [2:0],DBI [2:0] write_command(0xC0); //Power Control 1 write_data(0x12); //VRH[5:0] write_data(0x12); //VC[3:0] write_command(0xC1); //Power Control 2 write_data(0x04); //02,SAP[2:0],BT[3:0]VGL=12V,VGH=15V write_command(0xC5); //VCOM write_data(0XFD); //C8++ write_command(0xB1); write_data(0x00); write_data(0x1B); write_command(0xB4); write_data(0x02); //*****************GAMMA***************** write_command(0xE0); write_data(0x00);//P01-VP63 write_data(0x05);//P02-VP62 write_data(0x08);//P03-VP61 write_data(0x04);//P04-VP59 write_data(0x13);//P05-VP57 write_data(0x0A);//P06-VP50 write_data(0x34);//P07-VP43 write_data(0x8A);//P08-VP27,36 write_data(0x46);//P09-VP20 write_data(0x07);//P10-VP13 write_data(0x0E);//P11-VP6 write_data(0x0A);//P12-VP4 write_data(0x1B);//P13-VP2 write_data(0x1D);//P14-VP1 write_data(0x0F);//P15-VP0 write_command(0xE1); write_data(0x0C);//P01 write_data(0x05);//P02 write_data(0x08);//P03 write_data(0x04);//P04 write_data(0x13);//P05 write_data(0x0A);//P06 write_data(0x34);//P07 write_data(0x8A);//P08 write_data(0x46);//P09 write_data(0x07);//P10 write_data(0x0E);//P11 write_data(0x0A);//P12 write_data(0x1B);//P13 write_data(0x1D);//P14 write_data(0x0F);//P15 write_command(0x21); //********Window(´°¿Ú/µØÖ·)**************** write_command(0x2A); //320 write_data(0x00); write_data(0x00); write_data(0x01); write_data(0x3F); write_command(0x2B); //240 write_data(0x00); write_data(0x00); write_data(0x00); write_data(0xEF); //****************************** write_command(0x11);//Exit Sleep delay(120); write_command(0x29);//Display On write_command(0x2c); } //*********************************************** void LCD_Enter_Standby(void) { write_command(0x28);//display off delay(10); write_command(0x10); } void LCD_Exit_Standby (void) { write_command(0x11);// Exit Sleep/ Standby mode delay(120); write_command(0x29); }