//----------------------------------------- // Shenzhen TOPWAY Technology Co. Ltd. // LCD Module: LM6800 // Display size: 256x64 // Driver/Controller: S6B0106/S6B0107 // Interface: 68 mode // by: GuoQ // Date: 2011-03-24 // System; AT89S52 (12MHz) // note: 注释文字修改 // note: 初始化函数增加显示其始行归0 //----------------------------------------- #include #include #include #define uchar unsigned char #define uint unsigned int #define LCDBus P1 sbit RS = P3^6; sbit R_W = P3^2; sbit E = P3^7; sbit CSA = P3^4; sbit CSB = P3^3; sbit CSC = P3^1; sbit _RST = P3^5; //==================== // Display Data //==================== /*-- 265x64 --*/ /*-- LM6800 Logo --*/ uchar code Logo1[]={ 0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80, 0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0xA0,0x40,0xA0,0x40,0xA0,0x50,0xA0, 0x50,0xA0,0x50,0xA8,0x50,0xA8,0x50,0xA8,0x54,0xA8,0x54,0x28,0x14,0xAA,0x94,0xCA, 0xC4,0xEA,0xE4,0xE2,0xF5,0xF2,0xF9,0xFA,0xF9,0xF8,0xFD,0xFC,0xFD,0xFC,0xFD,0xFC, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x80,0x00,0x00, 0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x00, 0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x80,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00, 0x00,0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,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,0x01,0x03, 0x00,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,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x44,0xFF,0x24,0x54,0x21,0xF9,0x27, 0x21,0x21,0xE1,0x01,0x00,0x10,0x16,0x1A,0xD2,0x5F,0x52,0x52,0x5F,0x52,0xDA,0x16, 0x12,0x00,0x22,0xF1,0x08,0x17,0xD4,0x57,0xD4,0x17,0x78,0x87,0x7C,0x04,0x00,0x88, 0x49,0x29,0xFF,0x28,0xC8,0x92,0xA4,0x80,0xFF,0x40,0x40,0x00,0x44,0x24,0xFF,0x14, 0x00,0x04,0x74,0x94,0x1F,0x94,0x74,0x04,0x00,0x00,0x10,0x11,0x11,0xFF,0x11,0x11, 0x11,0xFF,0x11,0x11,0x10,0x00,0x00,0x06,0x05,0xC4,0x3C,0x57,0x94,0x14,0x94,0x75, 0x04,0x04,0x00,0x42,0x22,0x12,0xFA,0xAE,0xAB,0xAA,0xAA,0xAA,0xFA,0x03,0x02,0x00, 0x00,0xFF,0x88,0xF7,0x00,0xFF,0x14,0x74,0x94,0x54,0x3F,0x00,0x00,0x20,0x10,0x08, 0x06,0xC1,0x30,0x00,0x81,0x06,0x08,0x10,0x20,0x00,0x04,0x05,0xF5,0x95,0x95,0x95, 0xF5,0x05,0x05,0x01,0xFF,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,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, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x07,0x00,0x00,0x00,0x07,0x02, 0x02,0x02,0x07,0x00,0x00,0x00,0x00,0x00,0x07,0x05,0x05,0x05,0x05,0x05,0x07,0x00, 0x00,0x00,0x00,0x07,0x04,0x02,0x01,0x00,0x03,0x05,0x02,0x01,0x02,0x04,0x00,0x00, 0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x04,0x07,0x00, 0x04,0x04,0x04,0x02,0x01,0x02,0x04,0x04,0x00,0x00,0x04,0x02,0x01,0x00,0x00,0x00, 0x00,0x07,0x00,0x00,0x00,0x00,0x04,0x02,0x01,0x04,0x04,0x02,0x02,0x01,0x02,0x02, 0x04,0x04,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x04,0x07,0x00,0x00,0x00, 0x00,0x07,0x00,0x00,0x00,0x07,0x04,0x02,0x00,0x01,0x02,0x04,0x00,0x00,0x00,0x02, 0x07,0x02,0x02,0x02,0x02,0x03,0x06,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, 0x01,0x00,0x02,0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0xFE,0x02,0x02,0x00,0x7C,0x82, 0x82,0x82,0x7C,0x00,0xFE,0x12,0x12,0x12,0x0C,0x00,0x7E,0x80,0x70,0x80,0x7E,0x00, 0xF8,0x14,0x12,0x14,0xF8,0x00,0x06,0x08,0xF0,0x08,0x06,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x02,0x02,0xFE,0x02,0x02,0x00,0x70,0xA8,0xA8,0xA8,0x30,0x00,0x70,0x88, 0x88,0x88,0x88,0x00,0xFE,0x20,0x10,0x10,0xE0,0x00,0xF8,0x10,0x08,0x08,0xF0,0x00, 0x70,0x88,0x88,0x88,0x70,0x00,0x00,0x82,0xFE,0x80,0x00,0x00,0x70,0x88,0x88,0x88, 0x70,0x00,0x10,0xA8,0xA8,0xA8,0x78,0x00,0x18,0xA0,0xA0,0xA0,0x78,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x7C,0x82,0x82,0x82,0x44,0x00,0x70,0x88,0x88,0x88,0x70,0x00, 0x00,0x80,0x00,0x00,0x00,0x00,0xFE,0x80,0x80,0x80,0x00,0x08,0x08,0x7E,0x88,0x88, 0x00,0x70,0x88,0x88,0x88,0xFE,0x00,0x00,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0xF8, 0x10,0x60,0x10,0xF8,0x00,0xF0,0x48,0x48,0x48,0x80,0x00,0xB0,0x48,0x48,0x48,0xB0, 0x00,0xF0,0x88,0x48,0x28,0xF0,0x00,0xF0,0x88,0x48,0x28,0xF0,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x30,0x48,0x48,0x48,0x90,0x00,0xC0,0xA0,0xA0,0xA0,0xC0,0x00,0x00, 0xE0,0x40,0x20,0x20,0x00,0x00,0x20,0xE8,0x00,0x00,0x00,0xC0,0xA0,0xA0,0xA0,0xC0, 0x00,0x40,0xA0,0xA0,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x13,0x0A,0x8A,0x4A,0x32,0x00,0x3B, 0x28,0x28,0x28,0xCB,0x00,0xF1,0x4A,0x4A,0x4A,0x81,0x00,0x21,0x42,0x82,0x42,0x21, 0x00,0xF1,0x4A,0x4A,0x4A,0x81,0x00,0xC1,0xA2,0x92,0xFA,0x81,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xF9,0x4A,0x4A,0x4A,0x31,0x00,0x01,0x22,0xEA,0x02,0x00,0x00,0x20, 0x43,0x80,0x40,0x20,0x00,0xC0,0xA2,0xA3,0xA2,0xC0,0x00,0x01,0x0A,0xFA,0x02,0x00, 0x00,0x42,0xA2,0xA2,0xA2,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x80, 0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00, 0x00,0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80, 0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00, 0x80,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00, 0x00,0x00,0x00,0x80,0x00,0x00,0x80,0x80,0x80,0x82,0x83,0x02,0x02,0x82,0x80,0x81, 0x02,0x02,0x82,0x81,0x80,0x81,0x82,0x02,0x02,0x81,0x80,0x82,0x01,0x00,0x01,0x82, 0x80,0x81,0x02,0x02,0x02,0x81,0x80,0x80,0x00,0x00,0x03,0x00,0x80,0x00,0x00,0x00, 0x00,0x80,0x80,0x83,0x00,0x00,0x00,0x80,0x80,0x80,0x02,0x03,0x02,0x00,0x00,0x82, 0x01,0x00,0x81,0x82,0x80,0x81,0x82,0x02,0x02,0x80,0x80,0x80,0x02,0x03,0x82,0x80, 0x80,0x82,0x82,0x02,0x02,0x81,0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00, 0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x80,0x80,0x80, 0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x80,0x80, 0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00, 0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x80, 0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00, 0xC0,0x80,0x00,0x21,0x3F,0x20,0x00,0x00,0x21,0x30,0x28,0x24,0x23,0x00,0x11,0x20, 0x24,0x24,0x1B,0x00,0x0C,0x0A,0x09,0x3F,0x08,0x00,0x13,0x22,0x22,0x22,0x1C,0x00, 0x1F,0x24,0x24,0x24,0x18,0x00,0x00,0x00,0x3C,0x02,0x01,0x00,0x1B,0x24,0x24,0x24, 0x1B,0x00,0x13,0x24,0x24,0x24,0x1F,0x00,0x1F,0x28,0x24,0x22,0x1F,0x00,0x00,0x21, 0x3F,0x20,0x00,0x00,0x21,0x30,0x28,0x24,0x23,0x00,0x11,0x20,0x24,0x24,0x1B,0x00, 0x0C,0x0A,0x09,0x3F,0x08,0x00,0x13,0x22,0x22,0x22,0x1C,0x00,0x1F,0x24,0x24,0x24, 0x18,0x00,0x00,0x00,0x3C,0x02,0x01,0x00,0x1B,0x24,0x24,0x24,0x1B,0x00,0x13,0x24, 0x24,0x24,0x1F,0x00,0x1F,0x28,0x24,0x22,0x1F,0x00,0x00,0x21,0x3F,0x20,0x00,0x00, 0x21,0x30,0x28,0x24,0x23,0x00,0x11,0x20,0x24,0x24,0x1B,0x00,0x0C,0x0A,0x09,0x3F, 0x08,0x00,0x13,0x22,0x22,0x22,0x1C,0x00,0x1F,0x24,0x24,0x24,0x18,0x00,0x00,0x00, 0x3C,0x02,0x01,0x00,0x1B,0x24,0x24,0x24,0x1B,0x00,0x13,0x24,0x24,0x24,0x1F,0x00, 0x1F,0x28,0x24,0x22,0x1F,0x00,0x00,0x21,0x3F,0x20,0x00,0x00,0x21,0x30,0x28,0x24, 0x23,0x00,0x11,0x20,0x24,0x24,0x1B,0x00,0x0C,0x0A,0x09,0x3F,0x08,0x00,0x13,0x22, 0x22,0x22,0x1C,0x00,0x1F,0x24,0x24,0x24,0x18,0x00,0x00,0x00,0x3C,0x02,0x01,0x00, 0x1B,0x24,0x24,0x24,0x1B,0x00,0x13,0x24,0x24,0x24,0x1F,0x00,0x1F,0x28,0x24,0x22, 0x1F,0x00,0x00,0x21,0x3F,0x20,0x00,0x00,0x21,0x30,0x28,0x24,0x23,0x00,0x80,0xC0}; //==================== // delay routine //==================== void delayms(uint m) // 12MHz Xtal, close to ms value { uint j; uint i; for(i=0; i= 0) & (j<=63)) { wr_data(1,TempData); // 0~63 column goto driver 1 } if ((j>= 64) & (j<=127)) { wr_data(2,TempData); // 64~127 column goto driver 2 } if ((j>=128) & (j<=191)) { wr_data(3,TempData); // 128~191 column goto driver 3 } if ((j>=192) & (j<=255)) { wr_data(4,TempData); // 192-255 column goto driver 4 } } } } //==================== // Init LCD module //==================== void initLCDM(void) { RS = 0; // init all control signal R_W = 0; E = 0; CSC = 1; // disable all chips select CSB = 0; CSA = 0; _RST = 1; // hardware reset delayms(1); _RST = 0; delayms(1); _RST = 1; delayms(1); wr_command(1,0x3f); // display ON; wr_command(2,0x3f); // for all chips wr_command(3,0x3f); wr_command(4,0x3f); wr_command(1,0xc0); // start line =0; wr_command(2,0xc0); // for all chips wr_command(3,0xc0); wr_command(4,0xc0); } //************************ // Main Program //************************ void main(void) { SP = 0x60; // stack pointer EA = 0; // disable interrupts initLCDM(); // init LCD module WriteScreen(Logo1); // send a screen of display while(1) // end of program { _nop_(); } }