//------------------------------------------------- // Shenzhen TOPWAY Technology Co.,Ltd. // LCD Module: LM6059BDW // Display Size: 128*64 dots // Driver/Controller: ST7565P // Interface: 68 mode // System: AT89S52 (12MHz) // Rev00: by Li Yinyang 2016-03-22 // note: new //------------------------------------------------- #include #include #include #define uchar unsigned char // 0~255 #define uint unsigned int // 0~65535 #define LCDBUS P1 sbit _CS = P3^4; sbit _RST = P3^5; sbit A0 = P3^6; sbit _RW = P3^7; sbit E = P3^3; uchar ContrastLevel; // for contrast setting level //----------------------------------- // dispaly data (128x64) //----------------------------------- uchar code Logo[]={ /*-- ????????????C:\Documents and Settings\admin\????\LM6059B-logo-new.bmp --*/ /*-- ????x???=128x64 --*/ 0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x31,0x61,0xC1,0x81,0xE1, 0x31,0x11,0x11,0x91,0x11,0x11,0x11,0x11,0xD1,0x11,0x11,0x11,0xE1,0x01,0x01,0x01, 0x01,0x01,0xF1,0x01,0x01,0x01,0x01,0x01,0xF1,0x01,0x01,0x01,0xF1,0x01,0x01,0x01, 0x01,0xF1,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xF1,0x01,0x01,0x01,0x21,0x21,0x21, 0xA1,0x61,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x01,0x01,0x01,0x01,0x41,0x41,0x41, 0x49,0x71,0xE1,0x41,0x41,0x41,0x41,0xC1,0x41,0x71,0x59,0x41,0x41,0x41,0x01,0x01, 0x01,0x01,0x01,0x01,0xC1,0x31,0x01,0xF1,0x01,0x01,0xF9,0x01,0x01,0xF1,0x01,0x01, 0xF1,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF, 0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x08,0x10,0xA0,0x00,0x21, 0x28,0x26,0x23,0x20,0xA0,0xFC,0xE0,0x20,0x20,0x23,0x26,0x28,0x20,0x00,0x00,0x00, 0x02,0x02,0xFF,0x02,0x02,0x02,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00, 0x00,0xFF,0x00,0x00,0x00,0x00,0x81,0x81,0x41,0xFF,0x61,0x21,0x31,0x80,0x60,0x38, 0xFF,0x10,0x10,0x10,0x10,0x10,0x10,0xF0,0x00,0x00,0x00,0x00,0x10,0x10,0x91,0x96, 0x98,0x90,0x9F,0x90,0x90,0x90,0x90,0x9F,0x90,0x90,0x98,0x9C,0x13,0x10,0x10,0x00, 0x00,0x00,0xC2,0x61,0xF8,0x0E,0x02,0x09,0xC9,0x29,0x29,0x69,0xC9,0x09,0x18,0x07, 0x7E,0x80,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, 0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x0C,0x03,0x30,0x10, 0x18,0x0C,0x06,0x03,0x01,0x7F,0x00,0x01,0x06,0x0C,0x08,0x10,0x20,0x00,0x00,0x00, 0x20,0x10,0x1F,0x08,0x04,0x42,0x70,0x1F,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00, 0x00,0x7F,0x00,0x00,0x00,0x00,0x20,0x60,0x40,0x7F,0x00,0x00,0x03,0x01,0x00,0x00, 0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x44, 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x3F,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x7F,0x00,0x40,0x30,0x0F,0x00,0x00,0x00,0x3F,0x10,0x4C,0x24, 0x10,0x0F,0x0F,0x10,0x60,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,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,0xFC,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0xFC,0xFC,0xFC,0x1C,0xFC,0xF0,0x00,0x00,0x00,0xF0,0xFC,0x1C,0xFC,0xFC,0xFC, 0x00,0x00,0xE0,0xF8,0xF8,0x9C,0xCC,0xCC,0xDC,0x98,0x10,0x00,0x00,0xE0,0xF8,0xF8, 0x1C,0x0C,0x1C,0xF8,0xF8,0xE0,0x00,0x00,0x80,0xF0,0xFC,0xFC,0xCC,0xCC,0xCC,0x8C, 0x00,0x00,0x00,0xE0,0xF8,0xF8,0x1C,0x0C,0x1C,0xF8,0xF8,0xE0,0x00,0x00,0xFC,0xFC, 0xFC,0x9C,0x9C,0x9C,0x9C,0x9C,0xFC,0xF8,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,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,0xFF,0xFF,0xFF,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0x00, 0x00,0xFF,0xFF,0xFF,0x00,0x01,0x1F,0xFF,0xF0,0xFF,0x1F,0x01,0x00,0xFF,0xFF,0xFF, 0x00,0x00,0x1F,0x7F,0x7F,0xE1,0xC0,0xE1,0x7F,0x7F,0x1F,0x00,0x00,0x1F,0x7F,0x7F, 0xE0,0xC0,0xE0,0x7F,0x7F,0x1F,0x00,0x00,0x31,0x71,0xF1,0xE0,0xC0,0xE1,0xFF,0x7F, 0x1F,0x00,0x00,0x23,0x67,0xEF,0xCE,0xCC,0xE6,0x7F,0x7F,0x1F,0x00,0x00,0xFF,0xFF, 0xFF,0xE3,0xE3,0xE3,0xE3,0xE3,0xE3,0xFF,0x7E,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, 0xFF,0x00,0xE0,0x20,0x20,0x20,0x20,0x00,0xC0,0x20,0x20,0x20,0x20,0x40,0x00,0x20, 0x20,0xE0,0x20,0x20,0x00,0xE0,0x40,0x80,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0xE0, 0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x40,0x00,0xE0,0x20,0x20,0x20, 0x40,0x80,0x00,0x00,0x00,0x00,0x80,0x40,0xE0,0x00,0x00,0x00,0x40,0x20,0x20,0x20, 0xC0,0x00,0xC0,0x20,0x20,0x20,0xC0,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80, 0x00,0x00,0x00,0x00,0xC0,0x20,0x20,0x20,0x40,0x00,0x00,0x80,0x40,0xE0,0x00,0x00, 0x00,0x00,0x00,0xE0,0x20,0x20,0x20,0xC0,0x00,0xA0,0x00,0x80,0x00,0x00,0x00,0x80, 0x00,0x00,0x80,0x80,0x80,0x00,0x00,0xE0,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0xFF, 0xFF,0x80,0x9F,0x81,0x81,0x81,0x80,0x80,0x88,0x91,0x91,0x92,0x92,0x8C,0x80,0x80, 0x80,0x9F,0x80,0x80,0x80,0x9F,0x80,0x81,0x86,0x88,0x9F,0x80,0x80,0x80,0x80,0x9F, 0x90,0x90,0x90,0x90,0x80,0x87,0x88,0x90,0x90,0x90,0x88,0x80,0x9F,0x90,0x90,0x90, 0x88,0x87,0x80,0x80,0x80,0x80,0x80,0x80,0x9F,0x80,0x80,0x80,0x90,0x98,0x94,0x92, 0x91,0x80,0x8E,0x91,0x91,0x91,0x8E,0x80,0x80,0x80,0x80,0x90,0x89,0x86,0x89,0x90, 0x80,0x80,0x80,0x80,0x8F,0x91,0x91,0x91,0x8E,0x80,0x86,0x85,0x84,0x9F,0x84,0x80, 0x80,0x80,0x80,0x9F,0x82,0x82,0x82,0x81,0x80,0x9F,0x80,0x90,0x89,0x86,0x89,0x90, 0x80,0x8F,0x92,0x92,0x92,0x8B,0x80,0x9F,0x80,0x89,0x92,0x92,0x94,0x89,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) { _RST=1; // hardware reset LCD module _RST=0; delayms(1); _RST=1; delayms(800); /*modify: E-value:0x12->0x1C*/ ContrastLevel=0x1c; // Contrast Level set close to middle ,v0=9.87V 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(0xa2); // LCD bias = 1/9 SdCmd(0xc8); // Common output mode select= reverse SdCmd(0x2f); // Power control = all on /*modify: 1+RA/RB :0x27->0x26 */ SdCmd(0x26); // Rab Ratio = 6.0 SdCmd(0xf8); // Booster Ratio = 4x SdCmd(0x00); // (two byte command) SdCmd(0x81); // E-Vol setting SdCmd(ContrastLevel); // (2byte command) } //----------------------------------- // Main Program //----------------------------------- void main() { SP=0x60; EA = 0; // disable interrupts _CS =1; _RST =1; A0 =1; E =0; // SCLK =1; // SID =1; initLCDM(); WriteScreen(Logo); while(1) { } } //end of program