//------------------------------------------------- // Shenzhen TOPWAY Technology Co.,Ltd. // LCD Module: LM6063D // Display Size: 128x64 // Driver/Controller: ST7565 // Interface: serial mode // by: GuoQ // Date: 2008-04-19 // note: 4x booster setting //------------------------------------------------- #include #include #include #define uchar unsigned char // 0~255 #define uint unsigned int // 0~65535 sbit _CS = P3^4; sbit _RST = P3^5; sbit A0 = P3^6; sbit SCLK = P1^6; sbit SID = P1^7; uchar ContrastLevel; // for contrast setting level //----------------------------------- // dispaly data (128x64) //----------------------------------- uchar code Logo[]={ /*-- ????????????D:\guoq files\technic support\pic\LM6063D-LOGO-128x64.bmp --*/ /*-- ????x???=128x64 --*/ 0xFF,0x01,0x81,0x01,0x81,0x01,0x81,0x01,0x81,0x41,0x81,0x41,0x81,0x41,0x81,0x41, 0x81,0x41,0xA1,0x41,0xA1,0x41,0xA1,0x51,0xA1,0x51,0xA1,0x51,0xA9,0x51,0xA9,0x51, 0xA9,0x55,0xA9,0x55,0x29,0x15,0xAB,0x95,0xCB,0xC5,0xEB,0xE5,0xE3,0xF5,0xF3,0xF9, 0xFB,0xF9,0xF9,0xFD,0xFD,0xFD,0xFD,0xFD,0xFD,0x01,0x01,0x41,0x81,0x01,0x81,0x81, 0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0xC1,0x01,0x01,0xC1,0x01,0x01,0x81, 0x01,0x01,0xC1,0x01,0x01,0x01,0xC1,0x01,0x01,0x81,0x81,0x81,0x81,0x81,0x81,0x81, 0x01,0x01,0x01,0x01,0x41,0x81,0x01,0x01,0x81,0x41,0x01,0x01,0x01,0x01,0x01,0x81, 0x41,0x81,0x01,0xC1,0x01,0x81,0x01,0xC1,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF, 0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x80,0x41,0xA8,0x55,0xAA,0x55,0xAA,0x55,0x2A,0x95,0xCA,0xE5,0xF2,0xF9, 0xF8,0xFD,0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x42,0xE4,0x10,0x00,0x11,0x94, 0x52,0xFC,0x50,0x92,0x14,0x11,0x00,0x84,0x84,0xFF,0x44,0x44,0xFF,0x00,0x00,0xFF, 0x00,0x00,0xFF,0x00,0x22,0x22,0xFF,0x12,0x2A,0x10,0xFC,0x13,0x10,0x10,0xF0,0x00, 0x00,0x08,0x0B,0x0D,0xE9,0xAF,0xA9,0xA9,0xAF,0xA9,0xED,0x0B,0x09,0x00,0x11,0xF8, 0x04,0x0B,0xEA,0x2B,0xEA,0x8B,0x3C,0xC3,0x3E,0x02,0x00,0x00,0x00,0x00,0x00,0xFF, 0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40, 0xA8,0x54,0x2A,0x95,0xCA,0xE5,0xF2,0xF9,0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x20,0x20,0x23,0x20,0x21,0x21,0x20, 0x20,0x23,0x20,0x20,0x21,0x21,0x20,0x20,0x21,0x20,0x22,0x21,0x20,0x20,0x20,0x20, 0x20,0x20,0x23,0x20,0x20,0x22,0x23,0x20,0x20,0x20,0x23,0x21,0x21,0x21,0x23,0x20, 0x20,0x20,0x20,0x20,0x23,0x22,0x22,0x22,0x22,0x22,0x23,0x20,0x20,0x20,0x20,0x23, 0x22,0x21,0x20,0x20,0x21,0x22,0x21,0x20,0x21,0x22,0x20,0x20,0x20,0x20,0x20,0xFF, 0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x20,0x14,0xCA,0xE1, 0xF8,0xFC,0xFF,0xFF,0xFB,0xFB,0xC3,0xFB,0xFB,0xFF,0xE7,0xDB,0xDB,0xDB,0xE7,0xFF, 0xC3,0xEB,0xEB,0xEB,0xF7,0xFF,0xE3,0xDF,0xEF,0xDF,0xE3,0xFF,0xCF,0xE7,0xEB,0xE7, 0xCF,0xFF,0xFB,0xF7,0xCF,0xF7,0xFB,0xFF,0xFF,0x00,0x01,0x01,0xFF,0x01,0x01,0x00, 0x3C,0x42,0x81,0x81,0x81,0x42,0x3C,0x00,0xFF,0x11,0x11,0x11,0x0E,0x03,0x3C,0xC0, 0x30,0x0E,0x01,0x0E,0x30,0xC0,0x3C,0x03,0xC0,0x30,0x2E,0x21,0x2E,0x30,0xC0,0x00, 0x01,0x06,0x08,0xF0,0x08,0x06,0x01,0x00,0x00,0x00,0x00,0xFF,0x80,0x80,0x80,0x80, 0x04,0xFF,0x84,0x00,0x78,0x84,0x84,0x48,0xFF,0x00,0x00,0x80,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,0xF0,0xF0,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0xF0,0xF0,0xF0,0x70,0xF0,0xC0,0x00,0x00,0x00,0xC0,0xF0,0x70,0xF0,0xF0, 0xF0,0x00,0x00,0x80,0xE0,0xE0,0x70,0x30,0x30,0x70,0x60,0x40,0x00,0x00,0x80,0xE0, 0xE0,0x70,0x30,0x70,0xE0,0xE0,0x80,0x00,0x00,0x80,0xE0,0xE0,0x70,0x30,0x30,0x70, 0x60,0x40,0x00,0x00,0xC0,0xE0,0xF0,0x30,0x30,0x30,0xF0,0xE0,0xC0,0x00,0x00,0xF0, 0xF0,0xF0,0x70,0x70,0x70,0x70,0x70,0xF0,0xE0,0xC0,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,0x00,0xFF,0xFF,0xFF,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x00,0x00,0xFF,0xFF,0xFF,0x00,0x07,0x7F,0xFC,0xC0,0xFC,0x7F,0x07,0x00,0xFF,0xFF, 0xFF,0x00,0x00,0x7F,0xFF,0xFF,0x86,0x03,0x87,0xFF,0xFE,0x7C,0x00,0x00,0x7F,0xFF, 0xFF,0x80,0x00,0x80,0xFF,0xFF,0x7F,0x00,0x00,0x7F,0xFF,0xFF,0x86,0x03,0x87,0xFF, 0xFE,0x7C,0x00,0x00,0xC0,0xC0,0xC0,0x00,0x06,0x06,0xFF,0xFF,0xF9,0x00,0x00,0xFF, 0xFF,0xFF,0x80,0x80,0x80,0x80,0x80,0xC0,0xFF,0xFF,0x3F,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,0x80,0xC0,0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x80,0x00, 0x80,0x40,0x40,0x40,0x80,0x00,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, 0x00,0x00,0x83,0x43,0x43,0x40,0x80,0x00,0x03,0x03,0x83,0xC0,0x00,0x00,0x03,0x03, 0x03,0xC0,0x40,0x40,0x41,0x81,0x03,0x43,0x03,0x01,0x01,0x00,0x00,0x00,0x00,0x01, 0x01,0x03,0x03,0x03,0x01,0xC1,0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x03,0x03,0x01, 0x01,0x00,0x00,0x00,0x00,0x01,0x03,0x83,0x43,0x43,0x43,0x41,0x80,0x00,0x40,0x43, 0xC3,0x43,0x43,0x03,0x43,0x43,0x43,0xC3,0x41,0x00,0x00,0xC0,0x40,0x40,0x40,0x00, 0x80,0x40,0x40,0x40,0x80,0x00,0x00,0xC0,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0xFF, 0xFF,0x80,0x80,0x80,0x81,0x80,0xBF,0x80,0x80,0x80,0xA0,0xB0,0xA8,0xA4,0xA3,0x80, 0x9D,0xA2,0xA2,0xA2,0x9D,0x80,0x80,0x80,0x80,0xA1,0x92,0x8C,0x92,0xA1,0x80,0x80, 0x80,0x80,0x9F,0xA2,0xA2,0xA2,0x9C,0x80,0x8C,0x8B,0x88,0xBF,0x88,0x80,0x80,0x80, 0x80,0xBF,0x84,0x84,0x84,0x83,0x80,0xBF,0x80,0xA1,0x92,0x8C,0x92,0xA1,0x80,0x9E, 0xA5,0xA5,0xA5,0x96,0x80,0xBF,0x80,0x92,0xA5,0xA5,0xA9,0x92,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x91,0xA2,0xA2,0xA4,0xA4,0x98,0x80,0x80,0x80, 0xBF,0x80,0x80,0x80,0x80,0xB8,0x86,0x81,0x80,0x80,0x93,0xA2,0xA2,0xA2,0x9C,0x80, 0x9F,0xA2,0xA2,0xA2,0x9C,0x80,0x93,0xA2,0xA2,0xA2,0x9C,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) { _RST=1; // hardware reset LCD module _RST=0; delayms(1); _RST=1; delayms(10); ContrastLevel=0x21; // default Contrast Level SdCmd(0xaf); // display on SdCmd(0x40); // display start line=0 SdCmd(0xa1); // ADC=1 SdCmd(0xa6); // normal display SdCmd(0xa4); // Display all point = off SdCmd(0xa2); // LCD bias = 1/9 SdCmd(0xc0); // Common output mode select= reverse SdCmd(0x2f); // Power control = all on SdCmd(0x25); // RA/RB setting SdCmd(0xf8);SdCmd(0x00);// Booster Ratio Set= 2x,3x,4x (2byte command) SdCmd(0x81); // E-Vol setting SdCmd(ContrastLevel); // (2byte command) } //----------------------------------- // Main Program //----------------------------------- void main() { SP=0x60; EA = 0; // disable interrupts // AutoRun=0; _CS =1; _RST =1; A0 =1; SCLK =0; SID =1; // _KeySel=1; // key not select initLCDM(); WriteScreen(Logo); while(1) { } } //end of program