//---------------------------------------------------- // Shenzhen TOPWAY Technology Co.,Ltd. // LCD Module: LM6066R // Display Size: 240x64 dots // Controller: RA8806 (6MHz) // note: // by: GuoQ // Date: 2014-01-18 //---------------------------------------------------- #include #include #include #define uchar unsigned char // 8bit, 0 ~ 255 #define uint unsigned int // 16bit, 0 ~ 65,535 #define ulong unsigned long // 32bit, 0 ~ 4,294,967,295 //-------------------------------------------------------------------- uchar code logo[]={ /*-- ????????????D:\guoq files\technic support\pic\LM6066R-logo.bmp --*/ /*-- ????x???=240x64 --*/ 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,0x80,0x00, 0x00,0x00,0x00,0x01,0x55,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00, 0x00,0xAA,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x15,0x55, 0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x02,0xAA,0xA8,0x7F,0xE0, 0x00,0x00,0x11,0x04,0x02,0x00,0x10,0x00,0x04,0x30,0x1D,0x50,0x03,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x55,0x55,0x41,0xFF,0xE0,0x33,0xFE, 0x11,0x24,0x01,0x00,0x13,0xFE,0x04,0x20,0x15,0x50,0x02,0x00,0x3D,0xFC,0x06,0x20, 0x1F,0xFC,0x00,0x01,0x80,0x00,0x0A,0xAA,0xAA,0x8F,0xFF,0xE0,0x1A,0x02,0x11,0x24, 0xFF,0xFE,0x10,0x40,0x3F,0xFC,0x25,0x50,0x7F,0xFE,0x25,0x04,0x04,0x20,0x00,0x04, 0x00,0x01,0x80,0x15,0x55,0x55,0x54,0x3F,0xFF,0xE0,0x02,0x92,0x11,0x24,0x01,0x00, 0xFE,0x40,0x12,0x48,0x4F,0xFE,0x04,0x00,0x29,0x04,0x04,0x10,0x00,0x04,0x00,0x01, 0x8A,0xAA,0xAA,0xAA,0xA8,0xFF,0xFF,0xE0,0x41,0x28,0x11,0x24,0x01,0x00,0x10,0x40, 0x0A,0x50,0x18,0x24,0x04,0x00,0x29,0xFC,0x08,0x18,0x7F,0xF4,0x00,0x01,0x80,0x00, 0x05,0x55,0x53,0xFF,0xFF,0xE0,0x32,0x24,0x7D,0x24,0x1F,0xF8,0x10,0x80,0x0A,0x50, 0x1F,0xC4,0x0F,0xF8,0x29,0x04,0x18,0x08,0x00,0x04,0x00,0x01,0x80,0x00,0x00,0xAA, 0x87,0xFF,0xFF,0xE0,0x10,0x20,0x11,0x24,0x11,0x08,0x1C,0xFC,0x7F,0xFE,0x30,0x14, 0x18,0x08,0x29,0x04,0x11,0x84,0x00,0x04,0x00,0x01,0x80,0x00,0x01,0x55,0x1F,0xFF, 0xFF,0xE0,0x03,0xFE,0x11,0x24,0x11,0x08,0x30,0x84,0x00,0x00,0x57,0x94,0x2F,0xF8, 0x2D,0xFC,0x61,0x02,0x1F,0xC4,0x00,0x01,0x80,0x00,0x02,0xAA,0x7F,0xFF,0xFF,0xE0, 0x08,0x70,0x11,0x24,0x11,0x08,0xD1,0x84,0x1F,0xF0,0x14,0x94,0xC8,0x08,0x25,0x22, 0x02,0x00,0x10,0x44,0x00,0x01,0x80,0x00,0x01,0x54,0xFF,0xFF,0xFF,0xE0,0x08,0xA8, 0x11,0x24,0x11,0x08,0x12,0x84,0x10,0x10,0x14,0x94,0x08,0x08,0x25,0x24,0x02,0x60, 0x10,0x44,0x00,0x01,0x80,0x00,0x02,0xA9,0xFF,0xFF,0xFF,0xE0,0x11,0x24,0x1D,0x24, 0x11,0x08,0x16,0x84,0x1F,0xF0,0x14,0xEC,0x0F,0xF8,0x25,0x18,0x04,0x20,0x1F,0xC4, 0x00,0x01,0x80,0x00,0x05,0x53,0xFF,0xFF,0xFF,0xE0,0x23,0x26,0x31,0x24,0x11,0x38, 0x10,0x84,0x10,0x10,0x18,0x9C,0x08,0x08,0x39,0x08,0x08,0x10,0x10,0x44,0x00,0x01, 0x80,0x00,0x0A,0xA7,0xFF,0xFF,0xFF,0xE0,0x26,0x23,0x42,0x24,0x01,0x00,0x10,0xFC, 0x1F,0xF0,0x18,0x36,0x08,0x08,0x21,0x64,0x1F,0xF8,0x00,0x04,0x00,0x01,0x80,0x00, 0x05,0x4F,0xFF,0xFF,0xFF,0xE0,0x00,0x20,0x06,0x04,0x01,0x00,0x70,0x84,0x10,0x10, 0x10,0x63,0x08,0x38,0x21,0x82,0x18,0x0C,0x00,0x1C,0x00,0x01,0x80,0x00,0x0A,0x9F, 0xFF,0xFF,0xFF,0xE0,0x00,0x20,0x00,0x00,0x01,0x00,0x00,0x80,0x10,0x00,0x00,0x00, 0x08,0x00,0x20,0x00,0x00,0x00,0x00,0x18,0x00,0x01,0x80,0x00,0x15,0x3F,0xFF,0xFF, 0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x2A,0x7F,0xFF,0xFF,0xFF,0xE0, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x14,0xFF,0xFF,0xFF,0xFF,0xE1,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xF1,0x80,0x00,0x29,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x01,0x80,0x00,0x53,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0xA7,0xFF,0xFF,0xFF,0xFF,0xE0,0xF9,0x80,0x00,0x00,0x30,0x00,0x00,0x07, 0xE3,0xC7,0xEC,0x71,0x9C,0xC3,0x00,0xF0,0x00,0x01,0x81,0x03,0x00,0x01,0x80,0x00, 0x4F,0xFF,0xFF,0xFF,0xFF,0xE1,0x8D,0x80,0x00,0x00,0x30,0x00,0x00,0x01,0x86,0x66, 0x3C,0x71,0x9C,0x66,0x01,0x98,0x00,0x01,0x83,0x03,0x00,0x01,0x80,0x00,0x8F,0xFF, 0xFF,0xFF,0xFF,0xE1,0x81,0xB1,0xE6,0xCF,0xB6,0x3C,0xD8,0x01,0x8C,0x36,0x36,0xFB, 0x36,0x66,0x03,0x01,0xE0,0x01,0x87,0x9B,0x00,0x01,0x80,0x01,0x1C,0x18,0xC3,0x77, 0x77,0x61,0xE1,0xDB,0x37,0x61,0xBB,0x66,0xEC,0x01,0x8C,0x36,0x36,0xDB,0x36,0x3C, 0x03,0x03,0x30,0x01,0x83,0x37,0x00,0x01,0x80,0x00,0xBF,0x77,0x5D,0x76,0xBA,0xE0, 0xF9,0x9B,0x36,0x63,0x33,0x66,0xCC,0x01,0x8C,0x36,0x36,0xDB,0x36,0x18,0x03,0x03, 0x30,0x01,0x83,0x33,0x00,0x01,0x80,0x01,0x3F,0x77,0x43,0x54,0x1D,0xE0,0x3D,0x9B, 0xF6,0x66,0x33,0x7E,0xCC,0x01,0x8C,0x37,0xE6,0xDB,0x36,0x18,0x03,0x03,0x30,0x01, 0x83,0x33,0x00,0x01,0x80,0x02,0x7F,0x78,0xDF,0xAD,0xDD,0xE0,0x0D,0x9B,0x06,0x66, 0x33,0x60,0xCC,0x01,0x8C,0x36,0x03,0x8E,0x7F,0x18,0x03,0x03,0x30,0x01,0x83,0x33, 0x00,0x01,0x80,0x04,0xFF,0xFF,0xFF,0xFF,0xFF,0xE1,0x8D,0x9B,0x36,0x6C,0x33,0x66, 0xCC,0x01,0x86,0x66,0x03,0x8E,0x63,0x18,0x01,0x9B,0x36,0xC1,0x83,0x37,0x60,0x01, 0x80,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0xF9,0x99,0xE6,0x6F,0xB3,0x3C,0xCC,0x01, 0x83,0xC6,0x03,0x8E,0x63,0x18,0x00,0xF1,0xE6,0xC1,0xF9,0x9B,0x60,0x01,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,0x40,0x00,0x00,0x00,0x01,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,0x01,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,0x01,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,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x7F, 0x00,0x7F,0x00,0x7C,0x00,0x3E,0x00,0x07,0xC0,0x01,0xF0,0x0F,0xFF,0xC0,0x00,0x00, 0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x7F,0x00,0x7F, 0x01,0xFF,0x00,0xFF,0x80,0x1F,0xF0,0x07,0xFC,0x0F,0xFF,0xF0,0x00,0x00,0x00,0x00, 0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x7F,0x00,0x7F,0x03,0xFF, 0x81,0xFF,0xC0,0x3F,0xF8,0x0F,0xFE,0x0F,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x7F,0x80,0xFF,0x07,0xFF,0x83,0xFF, 0xE0,0x7F,0xF8,0x1F,0xFE,0x0F,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, 0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x7F,0x80,0xFF,0x0F,0x87,0xC3,0xE3,0xE0,0xF8, 0x7C,0x3E,0x1F,0x0F,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00, 0x00,0x00,0x07,0x80,0x00,0x7B,0x80,0xEF,0x0F,0x03,0xC3,0xC1,0xE0,0xF0,0x3C,0x3C, 0x0F,0x0F,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00, 0x07,0x80,0x00,0x7B,0x80,0xEF,0x0F,0x03,0xC7,0x80,0xF0,0xF0,0x3C,0x3C,0x0F,0x0F, 0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x07,0x80, 0x00,0x7B,0xC1,0xEF,0x1E,0x00,0x07,0x80,0xF1,0xE0,0x00,0x78,0x00,0x0F,0x00,0x3C, 0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x79, 0xC1,0xCF,0x1E,0x00,0x07,0x80,0xF1,0xE0,0x00,0x78,0x00,0x0F,0x00,0x7C,0x00,0x00, 0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x79,0xC1,0xCF, 0x1E,0x7C,0x07,0x80,0xF1,0xE7,0xC0,0x79,0xF0,0x0F,0xFF,0xF8,0x00,0x00,0x00,0x00, 0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x79,0xE3,0xCF,0x1F,0xFE, 0x07,0x80,0xF1,0xFF,0xE0,0x7F,0xF8,0x0F,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x78,0xE3,0x8F,0x1F,0xFF,0x07,0x80, 0xF1,0xFF,0xF0,0x7F,0xFC,0x0F,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, 0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x78,0xE3,0x8F,0x1F,0xFF,0x87,0x80,0xF1,0xFF, 0xF8,0x7F,0xFE,0x0F,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00, 0x00,0x00,0x07,0x80,0x00,0x78,0xE3,0x8F,0x1F,0x07,0xC7,0x80,0xF1,0xF0,0x7C,0x7C, 0x1F,0x0F,0x0F,0xC0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00, 0x07,0x80,0x00,0x78,0xF7,0x8F,0x1E,0x03,0xC7,0x80,0xF1,0xE0,0x3C,0x78,0x0F,0x0F, 0x03,0xE0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x07,0x80, 0x00,0x78,0x77,0x0F,0x1E,0x03,0xC7,0x80,0xF1,0xE0,0x3C,0x78,0x0F,0x0F,0x01,0xF0, 0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x78, 0x77,0x0F,0x1E,0x03,0xC7,0x80,0xF1,0xE0,0x3C,0x78,0x0F,0x0F,0x01,0xF0,0x00,0x00, 0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x78,0x77,0x0F, 0x0E,0x03,0xC3,0xC1,0xE0,0xE0,0x3C,0x38,0x0F,0x0F,0x00,0xF8,0x00,0x00,0x00,0x00, 0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x78,0x3E,0x0F,0x0F,0x87, 0xC3,0xE3,0xE0,0xF8,0x7C,0x3E,0x1F,0x0F,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x01, 0x80,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFC,0x78,0x3E,0x0F,0x07,0xFF,0x83,0xFF, 0xE0,0x7F,0xF8,0x1F,0xFE,0x0F,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00, 0x00,0x00,0x00,0x00,0x07,0xFF,0xFC,0x78,0x3E,0x0F,0x07,0xFF,0x01,0xFF,0xC0,0x7F, 0xF0,0x1F,0xFC,0x0F,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00, 0x00,0x00,0x07,0xFF,0xFC,0x78,0x1C,0x0F,0x03,0xFE,0x00,0xFF,0x80,0x3F,0xE0,0x0F, 0xF8,0x0F,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00, 0x07,0xFF,0xFC,0x78,0x1C,0x0F,0x00,0xFC,0x00,0x3E,0x00,0x0F,0xC0,0x03,0xF0,0x0F, 0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x01,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,0x01,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,0x01,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,0x01,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, }; //----------------------------------- // delayms routine //----------------------------------- void delayms(uint m) // 12MHz Xtal, close to ms value { uint j; uint i; for(i=0; i0) { SdData(*pstr++); // д????????? } } //--------??????????------------------------- // 240*64????LCM void initLCDM() { //????????? SdCmd(0x00);SdData(0x04);//???????????????????λ??Ч??д?????????????????????????? SdCmd(0x0f);SdData(0x00);//?????ж?????? SdCmd(0x10);SdData(0x06);//?????????????? ??????????????????仯 SdCmd(0x11);SdData(0xe0);//???ù????????? SdCmd(0x12);SdData(0x31);//????RAM???????????????????????????????????? //?????????????????? SdCmd(0x03);SdData(0x00); //------------- SdCmd(0x01);SdData(0x60);//????BUSY??????Ч?? SdCmd(0x90);SdData(0x6f);//??????????λ?????? fr= 67.58hz //---------------------------------------------------------------- SdCmd(0x21);SdData(0x1d);//???????????λ??, ???????????????240 SdCmd(0x31);SdData(0x3f);//????????±??λ??????????У????64?? //??鹤????????????? SdCmd(0x40);SdData(0x00);//????????????λ??????????????1?? SdCmd(0x20);SdData(0x1d);//????????????λ??????????????????240?? SdCmd(0x50);SdData(0x00);//????????????λ???????У????1?? SdCmd(0x30);SdData(0x3f);//?????????±??λ??????????У????64?? //??????? SdCmd(0x60);SdData(0x00);//???ù??λ??X??????ó??? SdCmd(0x70);SdData(0x00);//???ù??λ??Y??????ó??? SdCmd(0x80);SdData(0x33);//?????????? SdCmd(0xf0);SdData(0x80);//??????????GB??????ASCII??0????? SdCmd(0xf1);SdData(0x00);//???????????? } //--------Clear RAM program-------------------- void ClearRAM() { SdCmd(0x12);SdData(0x33);// buth two ram page SdCmd(0xe0);SdData(0x00);// full data = 00H SdCmd(0xf0);SdData(0x08);// set full in ram D3=1 delayms(10); } //----------------------------------- // Write a Screen (with decompression) //----------------------------------- void ShowBMP(uchar x,y,width,high,uchar bmp[]) // (x,y)????????????????x??????λ???y?????????? // WHIDTH???????????????????λ????HIGH????????????????????λ?? { uint i,k; SdCmd(0x00);SdData(0x04); // ????д?????????????? SdCmd(0x12);SdData(0x32); // ?????RAM????????????? SdCmd(0x40);SdData(x); //???ù???????????λ?? SdCmd(0x20);SdData(x+width-1); //???ù???????????λ?? SdCmd(0x50);SdData(y); //???ù???????????λ?? SdCmd(0x30);SdData(y+high-1); //???ù????????±??λ?? SdCmd(0x60);SdData(x); //???ù??λ??X???? SdCmd(0x70);SdData(y); //???ù??λ??Y???? SdCmd(0xb0); k=width*high; //?????????? for(i=0;i