//------------------------------------------------- // Shenzhen TOPWAY Technology Co.,Ltd. // LCD Module: LM6029ACW-4 // Display Size: 128x64 // Driver/Controller: ST7565R // Interface: 80 mode // rev 00: By Dong 2014-07-17 // note: new // rev 01: By Dong 2014-09-09 // note: update parameter //------------------------------------------------- #include #include #include #define uchar unsigned char // 0~255 #define uint unsigned int // 0~65535 #define LCDBus P1 sbit _CS1 = P3^4; sbit _RES = P3^5; sbit RS = P3^6; sbit _WR = P3^7; sbit _RD = P3^1; uchar ContrastLevel; //----------------------------------- // dispaly data (128x64) //----------------------------------- uchar code Logo[]={ /*-- invoking a picture from??D:\guoq files\technic support\pic\logo pic\LM6029 LOGO.bmp --*/ /*-- Width x height=128x64 --*/ 0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xC1,0x81,0x01,0x01,0x81, 0xC1,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x81,0x01,0x01,0x01, 0x01,0x01,0xC1,0x01,0x01,0x01,0x01,0x01,0xC1,0x01,0x01,0x01,0xC1,0x01,0x01,0x01, 0x01,0xC1,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xC1,0x01,0x01,0x01,0x81,0x81,0x81, 0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x21,0xC1,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0xC1,0x61,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0xC1,0x01,0xC1,0x01,0x01,0xE1,0x01,0x01,0xC1,0x01,0x01, 0xC1,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF, 0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x20,0x41,0x83,0x02,0x87, 0xA0,0x98,0x8C,0x82,0x80,0xF0,0x80,0x80,0x83,0x8C,0x98,0xA0,0x83,0x00,0x00,0x00, 0x08,0x08,0xFF,0x08,0x08,0x08,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00, 0x00,0xFF,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0xFF,0x84,0x84,0xC4,0x00,0x80,0xE0, 0xFE,0x41,0x40,0x40,0x40,0x40,0x40,0xC0,0x00,0x00,0x00,0x00,0x40,0x41,0x45,0x59, 0x61,0x41,0x7F,0x41,0x41,0x41,0x41,0x7F,0x41,0x41,0x61,0x71,0x4D,0x41,0x40,0x00, 0x00,0x00,0x08,0x84,0xE3,0x38,0x08,0x27,0x24,0xA4,0xA7,0xA4,0x24,0x27,0x60,0x1C, 0xFB,0x02,0x02,0xFE,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, 0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x30,0x0E,0xC0,0x40, 0x60,0x30,0x18,0x0C,0x06,0xFF,0x03,0x04,0x18,0x30,0x20,0x40,0x80,0x00,0x00,0x00, 0x80,0x40,0x7F,0x20,0x10,0x08,0xC0,0x7C,0x03,0x00,0x00,0x00,0xFF,0x00,0x00,0x00, 0x00,0xFF,0x00,0x00,0x00,0x00,0x82,0x82,0x01,0xFF,0x01,0x00,0x0C,0x06,0x01,0x00, 0xFF,0x80,0x80,0x80,0x80,0x80,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x12, 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x92,0xFC,0x00,0x00,0x00, 0x00,0x00,0x03,0x01,0xFF,0x00,0x00,0xC0,0x3F,0x00,0x00,0x01,0xFF,0x40,0x30,0x90, 0x41,0x3E,0x3E,0x41,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, 0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00, 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, 0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFC,0xFC,0x7C,0xFC,0xF0, 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xF0,0xFC,0x7C,0xFC,0xFC,0xFC,0x00, 0x00,0x00,0x00,0x00,0xC0,0xE0,0xF0,0x78,0x38,0x1C,0x1C,0x1C,0x1C,0x1C,0x3C,0x78, 0xF8,0xF0,0xC0,0x00,0x00,0x00,0xE0,0xF0,0xF8,0x38,0x3C,0x1C,0x1C,0x1C,0x1C,0x3C, 0x38,0xF8,0xF0,0xC0,0x00,0x00,0x00,0xC0,0xF0,0xF8,0x38,0x3C,0x1C,0x1C,0x1C,0x1C, 0x1C,0x3C,0x78,0xF8,0xF0,0xC0,0x00,0x00,0x00,0x80,0xE0,0xF0,0x78,0x38,0x1C,0x1C, 0x1C,0x1C,0x1C,0x1C,0x38,0x70,0xF0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, 0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x03,0x3F, 0xFF,0xF8,0xC0,0x00,0x00,0x00,0xC0,0xF8,0xFF,0x3F,0x03,0x00,0xFF,0xFF,0xFF,0x00, 0x00,0x00,0x00,0xFE,0xFF,0xFF,0x71,0x38,0x38,0x1C,0x1C,0x1C,0x1C,0x1C,0x3C,0x78, 0xF0,0xE0,0xC0,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, 0xC0,0xE0,0x78,0x3F,0x1F,0x07,0x00,0x00,0x00,0x1F,0x3F,0x7F,0xF0,0xE0,0xC0,0xC0, 0xC0,0xC0,0xC0,0xC0,0xE0,0x70,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, 0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xC0,0xC0,0xC0,0xC0,0xC0, 0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00, 0x01,0x1F,0xFF,0xFC,0xC0,0xFC,0xFF,0x1F,0x01,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00, 0x00,0x00,0x00,0x07,0x1F,0x7F,0x78,0xE0,0xE0,0xC0,0xC0,0xC0,0xC0,0xC0,0xE0,0xF0, 0x7F,0x3F,0x0F,0x00,0x00,0x07,0x3F,0x7F,0xF8,0xE0,0xE0,0xC0,0xC0,0xC0,0xC0,0xE0, 0xE0,0xF8,0x7F,0x3F,0x07,0x00,0x00,0x80,0xE0,0xF0,0xF8,0xDC,0xCE,0xC6,0xC7,0xC3, 0xC1,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x18,0x78,0xF8,0xF0,0xE1,0xC1,0xC1, 0xC1,0xC1,0xC1,0xE0,0xF0,0x7C,0x3F,0x1F,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, 0xFF,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81, 0x81,0x81,0x81,0x81,0x81,0x81,0x80,0x80,0x80,0x80,0x81,0x81,0x81,0x80,0x80,0x80, 0x80,0x80,0x80,0x81,0x81,0x81,0x80,0x80,0x80,0x80,0x80,0x80,0x81,0x81,0x81,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x81,0x81,0x81,0x81,0x81,0x81,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x81,0x81,0x81,0x81,0x81,0x81, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81, 0x81,0x81,0x81,0x81,0x81,0x81,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x81,0x81,0x81, 0x81,0x81,0x81,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFF, }; //----------------------------------- // Delay Routine //----------------------------------- void delayms(uint m) // 12MHz Xtal, close to ms value { uint j; uint i; for(i=0; i0x00) ContrastLevel--; SdCmd(0x81); // E-Vol setting SdCmd(ContrastLevel); // (2byte command) } //----------------------------------- // Init LCD module //----------------------------------- void initLCDM(void) { _RES=1; // hardware reset LCD module _RES=0; delayms(5); _RES=1; delayms(800); ContrastLevel=0x1c; //Update 0x1b -> 0x1c (V0=9.1V) SdCmd(0xaf); // display on SdCmd(0x40); // display start line=0 SdCmd(0xa0); // ADC=0 SdCmd(0xa6); // normal display SdCmd(0xa4); // Duisplay all point = off SdCmd(0xa3); // Update LCD bias 0xa2->0xa3 (1/9->1/7) SdCmd(0xc8); // Common output mode select= reverse SdCmd(0x2f); // Power control = all on SdCmd(0x25); // Update 0x27->0x25 (Ra/Rb = 5.5 ) SdCmd(0x81); // E-Vol setting SdCmd(ContrastLevel); // (2byte command) } //----------------------------------- // Main Program //----------------------------------- void main() { SP=0x60; EA = 0; // disable interrupts _CS1 = 1; _RES = 1; RS = 1; _WR = 1; _RD = 1; initLCDM(); WriteScreen(Logo); while(1); } //end of program