//------------------------------------------------- // Shenzhen TOPWAY Technology Co.,Ltd. // LCD Module: LM6071C // Display Size: 192x64 // Driver/Controller: IST3020 // Interface: 8080 mode // by: GuoQ // Date: 2011-04-09 //------------------------------------------------- #include #include #include #define uchar unsigned char // 0~255 #define uint unsigned int // 0~65535 #define LCDBus P1 sbit _RD = P3^2; sbit _WR = P3^7; sbit RS = P3^1; sbit _CS = P3^3; sbit _RST = P3^5; uchar ContrastLevel; // for contrast setting level //----------------------------------- // dispaly data (128x64) //----------------------------------- uchar code Logo[]={ /*-- ????????????D:\??\6071C.bmp --*/ /*-- ????x???=192x64 --*/ 0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF, 0xFF,0x00,0x00,0x00,0x00,0x00,0x10,0x22,0x84,0x00,0x8C,0xA4,0x94,0xE4,0x84,0x94, 0xA4,0x8C,0x00,0x20,0x20,0xFE,0x20,0x20,0xFE,0x00,0x00,0xFC,0x00,0x00,0xFE,0x00, 0x08,0x08,0xE8,0x28,0x28,0x2A,0xFC,0x28,0x28,0xE8,0x0C,0x08,0x00,0x10,0x10,0xFE, 0x90,0x50,0x84,0xE4,0x9C,0x84,0x84,0x84,0x04,0x00,0x40,0x58,0x68,0x4A,0x7C,0x48, 0x48,0x7C,0x4A,0x68,0x58,0x48,0x00,0x88,0xC4,0x22,0x5C,0x50,0x5E,0x50,0x5C,0xE0, 0x1E,0xF0,0x10,0x00,0x20,0x24,0xA4,0xFC,0xA2,0x20,0x48,0x90,0x00,0xFE,0x00,0x00, 0x00,0x10,0x90,0xFE,0x50,0x00,0x10,0xD0,0x50,0x7E,0x50,0xD0,0x10,0x00,0x00,0x40, 0x44,0x44,0xFC,0x44,0x44,0x44,0xFC,0x46,0x44,0x40,0x00,0x00,0x18,0x14,0x10,0xF0, 0x5E,0x50,0x50,0x52,0xD4,0x10,0x10,0x00,0x08,0x88,0x48,0xE8,0xB8,0xAE,0xA8,0xA8, 0xA8,0xE8,0x0C,0x08,0x00,0x00,0xFE,0x22,0xDE,0x00,0xFE,0x52,0xD2,0x52,0x52,0xFE, 0x00,0x00,0x80,0x40,0x20,0x18,0x06,0xC0,0x00,0x06,0x18,0x20,0x40,0x80,0x00,0x10, 0x14,0xD4,0x54,0x54,0x54,0xD4,0x14,0x14,0x04,0xFE,0x04,0x00,0x00,0x00,0x00,0xFF, 0xFF,0x00,0x00,0x00,0x00,0x00,0x02,0x1F,0x00,0x08,0x08,0x04,0x02,0x1F,0x02,0x04, 0x08,0x08,0x00,0x04,0x0C,0x07,0x12,0x0A,0x07,0x00,0x00,0x07,0x00,0x00,0x1F,0x00, 0x00,0x00,0x0F,0x00,0x00,0x00,0x1F,0x00,0x08,0x0F,0x00,0x00,0x00,0x01,0x11,0x1F, 0x00,0x01,0x00,0x1F,0x08,0x08,0x08,0x1F,0x00,0x00,0x00,0x00,0x00,0x1F,0x15,0x15, 0x15,0x15,0x15,0x1F,0x00,0x00,0x00,0x00,0x1F,0x10,0x08,0x07,0x01,0x0F,0x14,0x09, 0x06,0x09,0x10,0x00,0x02,0x01,0x00,0x1F,0x00,0x03,0x02,0x02,0x02,0x1F,0x01,0x01, 0x00,0x01,0x10,0x1F,0x00,0x10,0x10,0x11,0x0A,0x04,0x0A,0x11,0x10,0x00,0x00,0x10, 0x08,0x04,0x03,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x10,0x08,0x04,0x13,0x10, 0x09,0x0A,0x04,0x0A,0x09,0x10,0x10,0x00,0x01,0x00,0x00,0x1F,0x02,0x02,0x02,0x02, 0x12,0x1F,0x00,0x00,0x00,0x00,0x1F,0x02,0x03,0x00,0x1F,0x10,0x09,0x02,0x05,0x08, 0x10,0x00,0x00,0x00,0x08,0x1C,0x0B,0x08,0x08,0x0A,0x0C,0x18,0x00,0x00,0x00,0x00, 0x00,0x07,0x02,0x02,0x02,0x07,0x00,0x08,0x10,0x0F,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,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFC,0xE0,0x00,0x00,0xE0,0xFC,0xFF, 0xFF,0xFF,0x00,0x00,0x00,0x00,0xE0,0xF8,0xFC,0x1E,0x87,0xC3,0xC3,0xC7,0x9E,0x9E, 0x18,0x00,0x00,0x00,0xE0,0xF8,0xFC,0x1E,0x07,0x03,0x03,0x03,0x07,0x1E,0xFE,0xF8, 0xE0,0x00,0x00,0x00,0x03,0x03,0x03,0x03,0x03,0x03,0x83,0xF3,0xFF,0x7F,0x0F,0x00, 0x00,0x00,0x00,0x00,0x08,0x08,0x0C,0xFE,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0xE0,0xF8,0xFC,0x1E,0x07,0x03,0x03,0x03,0x0F,0x7E,0x7C,0x70,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x3F,0xFE,0xFE,0x3F,0x00,0xFF, 0xFF,0xFF,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0x83,0x00,0x00,0x00,0x01,0xFF,0xFF, 0xFE,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF, 0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xFC,0xFF,0x3F,0x07,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x3F,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x80,0xF8,0xF8,0x78,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x06,0x06,0x06,0x06,0x06,0x06, 0x06,0x06,0x06,0x00,0x00,0x00,0x07,0x07,0x07,0x00,0x00,0x07,0x07,0x00,0x00,0x07, 0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x06,0x06,0x06,0x07,0x03,0x01, 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x06,0x06,0x06,0x07,0x03,0x03,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x07,0x07,0x01,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x03,0x03,0x07,0x06,0x06,0x07,0x07,0x03,0x01,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,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,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) { _RST=1; // hardware reset LCD module _RST=0; delayms(1); _RST=1; delayms(800); ContrastLevel=0x1f; // default Contrast Level SdCmd(0x40); // ????ж???0 SdCmd(0xa1); // ADC=1 SdCmd(0xa6); // ??????? SdCmd(0xa4); // ???????? SdCmd(0xa2); // LCD bias = 1/9 SdCmd(0xc0); // ?????0--63 SdCmd(0x82); SdCmd(0x0e); //??????65.79Hz SdCmd(0x30); //M???0?з?? SdCmd(0x23); // RA/RB SdCmd(0x2c); // ??VC delayms(50); SdCmd(0x2e); // ??VC,VR delayms(50); SdCmd(0x2f); // ??VC,VR,VF delayms(50); SdCmd(0x81); // ??????? SdCmd(ContrastLevel); // (2byte command) SdCmd(0xab); //????????? SdCmd(0xaf); // ????? } //----------------------------------- // Main Program //----------------------------------- void main() { SP=0x60; EA = 0; // disable interrupts LCDBus = 0xFF; _RST = 1; _RD = 1; _WR = 1; RS = 1; _CS = 1; initLCDM(); WriteScreen(Logo); while(1) { } } //end of program