//------------------------------------------------- // Shenzhen TOPWAY Technology Co.,Ltd. // LCD Module: LM6064X // Display Size: 128x64 // Driver/Controller: ST7565 // System: AT89S52 12MHz // Interface: 8080 mode // by: Lixiaochun // Date: 2018-11-08 // note: 4x booster setting //------------------------------------------------- #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 _WR = P3^7; sbit _RD = P3^1; sbit _KeySel = P3^0; // _KeySel=0, key scanning active sbit _KeyDarker = P1^1; // _KeyDarker=0, key pressed sbit _KeyLighter = P1^2; // _KeyLighter=0,key pressed uchar ContrastLevel; // for contrast setting level //----------------------------------- // dispaly data (128x64) //----------------------------------- uchar code Logo[]={ /*-- ????????????D:\guoq files\technic support\pic\LM6063X-LOGO-128x64.bmp --*/ /*-- ????x???=128x64 --*/ 0x0F,0x01,0x11,0x01,0x10,0x00,0x10,0x00,0x10,0x08,0x10,0x08,0x10,0x08,0x10,0x08, 0x10,0x08,0x14,0x28,0x14,0xA8,0x54,0xAA,0x54,0xAA,0x54,0xAA,0x55,0xAA,0x55,0x2A, 0x15,0xAA,0x95,0xCA,0xE5,0xE2,0xF5,0xF2,0xF9,0xF8,0xFD,0xFC,0xFC,0xFE,0xFE,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x40,0x88,0x10,0x00,0x30,0x90, 0x50,0x90,0x10,0x50,0x90,0x30,0x00,0x80,0x80,0xF8,0x80,0x80,0xF8,0x00,0x00,0xF0, 0x00,0x00,0xF8,0x00,0x40,0x40,0xF8,0x40,0x40,0x10,0x90,0x70,0x10,0x10,0x10,0x10, 0x00,0x00,0x60,0xA0,0x28,0xF0,0x20,0x20,0xF0,0x28,0xA0,0x60,0x20,0x00,0x20,0x10, 0x88,0x70,0x40,0x78,0x40,0x70,0x80,0x78,0xC0,0x40,0x00,0x00,0x01,0x01,0x01,0x0F, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x80,0x50,0xA8,0x55,0xAA,0x55,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,0x00,0x08,0x7C,0x02,0x20,0x22,0x12, 0x0A,0x7F,0x0A,0x12,0x22,0x22,0x00,0x10,0x30,0x1F,0x48,0x28,0x1F,0x00,0x00,0x1F, 0x00,0x00,0x7F,0x00,0x04,0x44,0x7F,0x02,0x05,0x02,0x7F,0x22,0x22,0x22,0x7E,0x00, 0x00,0x01,0x01,0x01,0x7D,0x55,0x55,0x55,0x55,0x55,0x7D,0x01,0x01,0x00,0x02,0x7F, 0x40,0x21,0x1D,0x05,0x3D,0x51,0x27,0x18,0x27,0x40,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x50,0x28, 0x15,0x8A,0xE5,0xF2,0x79,0x7C,0x7E,0x7F,0x7F,0xFF,0xFF,0x7F,0x7F,0x7F,0xFF,0xFF, 0x7F,0x7F,0x7F,0x7F,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF, 0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0x04,0x24,0x24,0xE4,0x24,0x24,0x04, 0x84,0x44,0x24,0x24,0x24,0x44,0x84,0x04,0xE4,0x24,0x24,0x24,0xC4,0x64,0x84,0x04, 0x04,0xC4,0x24,0xC4,0x04,0x04,0x84,0x64,0x04,0x04,0xC4,0x24,0xC4,0x04,0x04,0x04, 0x24,0xC4,0x04,0x04,0x04,0xC4,0x24,0x04,0x04,0x04,0x04,0xE4,0x04,0x04,0x04,0x04, 0x84,0xE4,0x84,0x04,0x04,0x84,0x84,0x04,0xE4,0x04,0x04,0x04,0x04,0x04,0x04,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x02,0x19,0x1C, 0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x18,0x1F,0x1F,0x1F,0x1C,0x1B,0x1B,0x1B,0x1C,0x1F, 0x18,0x1D,0x1D,0x1D,0x1E,0x1F,0x1C,0x1B,0x1D,0x1B,0x1C,0x1F,0x19,0x1C,0x1D,0x1C, 0x19,0x1F,0x1F,0x1E,0x19,0x1E,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x1F,0x00,0x00,0x00, 0x07,0x08,0x10,0x10,0x10,0x08,0x07,0x00,0x1F,0x02,0x02,0x02,0x01,0x00,0x07,0x18, 0x06,0x01,0x00,0x01,0x06,0x18,0x07,0x00,0x18,0x06,0x05,0x04,0x05,0x06,0x18,0x00, 0x00,0x00,0x01,0x1E,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x10,0x10,0x10,0x10, 0x00,0x1F,0x10,0x00,0x0F,0x10,0x10,0x09,0x1F,0x00,0x00,0x10,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xF8,0xF8,0xF8,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xF8,0xF8,0xF8,0x78,0xF8,0xF0, 0x00,0x00,0x00,0x00,0x00,0xF0,0xF8,0x78,0xF8,0xF8,0xF8,0xF8,0x00,0x00,0x00,0xC0, 0xE0,0xF0,0xF0,0x38,0x38,0x38,0x78,0xF8,0xF0,0xE0,0xC0,0x00,0x00,0x00,0xC0,0xF0, 0xF0,0xF8,0x38,0x38,0x38,0xF8,0xF0,0xF0,0xC0,0x00,0x00,0x00,0x00,0xC0,0xE0,0xF0, 0xF0,0x38,0x38,0x38,0x78,0xF8,0xF0,0xE0,0xC0,0x00,0x00,0xC0,0xE0,0xF0,0xF8,0x78, 0x38,0x38,0x78,0xF8,0xF0,0xE0,0xC0,0x00,0x00,0x00,0x00,0x18,0x38,0xF8,0xF8,0xF0, 0xC0,0x00,0x00,0xC0,0xF0,0xF8,0xF8,0x38,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x0F,0xFF, 0xFF,0xF0,0x00,0xF0,0xFF,0xFF,0x0F,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xFE,0xFF, 0xFF,0xFF,0x38,0x1C,0x1C,0x1C,0x3C,0xFC,0xF8,0xF0,0xC0,0x00,0x00,0xFF,0xFF,0xFF, 0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xFE,0xFF,0xFF,0xFF, 0x38,0x1C,0x1C,0x1C,0x3C,0xFC,0xF8,0xF0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x1C,0x1C,0x1E,0x3F,0xF7,0xF7,0xE1,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0xC3,0xE7, 0xFF,0xFF,0xFF,0xFF,0xE7,0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x7F,0x78,0x78,0x78, 0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x00,0x00,0x7F,0x7F,0x7F,0x7F,0x00,0x00,0x00, 0x1F,0x7F,0x7E,0x7F,0x1F,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x7F,0x00,0x00,0x03,0x0F, 0x1F,0x3F,0x78,0x70,0x70,0x70,0x78,0x3F,0x3F,0x1F,0x07,0x00,0x00,0x03,0x0F,0x3F, 0x3F,0x7C,0x70,0x70,0x70,0x7C,0x3F,0x3F,0x0F,0x03,0x00,0x00,0x03,0x0F,0x1F,0x3F, 0x78,0x70,0x70,0x70,0x78,0x3F,0x3F,0x1F,0x07,0x00,0x00,0x06,0x1E,0x3E,0x3E,0x78, 0x70,0x70,0x70,0x78,0x3F,0x3F,0x1F,0x07,0x00,0x00,0x60,0x70,0x7C,0x7F,0x3F,0x0F, 0x03,0x00,0x00,0x03,0x0F,0x3F,0x7F,0x7C,0x70,0x60,0x00,0x00,0x00,0x00,0x00,0x00, 0xF0,0x80,0x80,0x80,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,0x80,0x80,0x80,0xF0, }; //----------------------------------- // 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(10); _RST=1; delayms(800); ContrastLevel=0x23; // 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 _CS =1; _RST =1; A0 =1; _WR =1; _RD =1; _KeySel=1; // key not select initLCDM(); WriteScreen(Logo); while(1) { } } //end of program