//*************************************************************** // //***** Focus LCDs ***** //***** LCDs Made Simple ***** //***** www.FocusLCDs.com ***** // //*************************************************************** // //NOTE:VCI=3.3V //********************************************** 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; } //********************Display data***************************** void write_data1(byte data_h,data_l) { cs=0; rs=1; rd=1; rw=1; P2=data_h; P0=data_l; rw=0; rw=1; cs=1; } /*************************************************/ void initi(void) { res=1; delay(10); res=0; delay(10); res=1; delay(120); //************Start Initial Sequence**************************** write_command(0xC8); //Set EXTC write_data(0xFF); write_data(0x93); write_data(0x42); 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(0x0C); //VRH[5:0] write_data(0x06); //VC[3:0] write_command(0xC1); //Power Control 2 write_data(0x20); //SAP[2:0],BT[3:0] write_command(0xC5); //VCOM write_data(0XE7); //C8++ write_command(0xB1); write_data(0x00); write_data(0x1B); write_command(0xB4); write_data(0x02); write_command(0xb6); write_data(0x0a); write_data(0xE0);//SS GS //*****************GAMMA***************** write_command(0xE0); write_data(0x00);//P01-VP63 write_data(0x04);//P02-VP62 write_data(0x09);//P03-VP61 write_data(0x05);//P04-VP59 write_data(0x13);//P05-VP57 write_data(0x09);//P06-VP50 write_data(0x35);//P07-VP43 write_data(0x69);//P08-VP27,36 write_data(0x46);//P09-VP20 write_data(0x04);//P10-VP13 write_data(0x0C);//P11-VP6 write_data(0x09);//P12-VP4 write_data(0x15);//P13-VP2 write_data(0x16);//P14-VP1 write_data(0x0F);//P15-VP0 write_command(0xE1); write_data(0x00);//P01 write_data(0x1F);//P02 write_data(0x20);//P03 write_data(0x03);//P04 write_data(0x0F);//P05 write_data(0x05);//P06 write_data(0x38);//P07 write_data(0x55);//P08 write_data(0x4C);//P09 write_data(0x04);//P10 write_data(0x0E);//P11 write_data(0x0B);//P12 write_data(0x37);//P13 write_data(0x37);//P14 write_data(0x0F);//P15 //********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); } //*****************************************************